views:

414

answers:

3

I need a program that I can pipe a raw PCM stream into, and will send wav files to stdout.

Since the input is a stream, I can't just add headers to it, but I can for every x seconds (For example, program reads ten seconds of the stream, and outputs a ten second long wav file, reads the next ten seconds, outputs a wav file, and so on).

Is there a program that can do this? It needs to run on Linux.

+2  A: 

Check out sox, the Swiss Army knife of sound processing.

Thomas
+1  A: 

This is a dead simple program to write, in fact, if you can guarantee exactly the same number of bytes of PCM data in each wave file, you can just pre-create a standard wave file header for that amount of PCM data and then just cat wavehdr + chunk-of-streamdata

John Knoeller
I started writing it, but then I decided to see if this already existed. Oh well, I guess not. Thanks
Jeffrey Aylesworth
+1  A: 

mplayer is quite good for this kind of tasks. It comes with two interface, mencoder and mplayer. mencoder as all the command line switch you want to transform raw pcm into various sound format.

It also come with a very long man page that explains all the options quite well.

shodanex