How to play audio with SNDC

The sndc executable dumps the content of the last node’s output named out. If the last node of the file you are trying to play does not have an output named out, sndc will not dump anything at all. So first, make sure to check the specification of the last node of your file to make sure it does have an output of type BUFFER named out.

Using aplay

On Linux systems, you can use aplay to play the audio directly.

Simply pipe the sndc command into aplay like so:

$ sndc <file> | aplay -r 44100 -c 1 -f FLOAT_LE -t raw

If the buffer that sndc will output has more that one channel interlaced together (e.g after using the interlace module), adapt the -c parameter with the right number of channels.

If your system is big endian, use -f FLOAT_BE instead.

Note that this command is wrapped in the sndc_play script, which will also figure out your system’s endianess automatically, and will pass through the -c and -r arguments. It will also sleep a fraction of a second before calling sndc to let the sound card warm up.

$ sndc_play <file> -c 2 -r 44100