pedantic.software --pedantic

Invoking sndc

sndc takes an input file as argument and will output a stream of raw floats into stdout.

Example:

$ sndc example.sndc

This will realistically clutter your terminal with unreadable garbage. The intended use is to then pipe the output to a program that can either play the sound or convert it to whatever audio format you want.

On Linux, aplay and sox (respectively) are good fits for those purposes. So in general, a typical incantation to play the synthesized sound will look like:

$ sndc example.sndc | aplay -c 1 -r 44100 -f float_le -t raw

-c 1 indicate that we have only one channel, -r 44100 indicate the sampling rate, -f float_le -t raw means the input is a stream of raw floats in little endian.

Conversely, the sox incantation to export the sound into a more civilized format will usually look like:

$ sndc example.sndc | sox -c 1 -r 44100 -e FLOAT -b 32 -L -t raw - example.mp3

The arguments are pretty symmetrical to the one used with aplay, except for -L which is sox dialect for “little endian”, and sox also wants to know the size of your floats with -b 32. sox will determine automatically which encoder to use based on the suffix of the output file (we could write example.ogg or example.flac instead without modifying the rest of the command).

Fortunately, you don’t have to remember those commands since they are wrapped into two bash scripts, sndc_play and sndc_export that got installed with sndc and will figure out themself what endianess your system is using.

Invoke them like so:

$ sndc_play example.sndc
$ sndc_export example.sndc example.ogg # or .flac or .mp3 etc