This program reads data from standard input, buffers it, then writes it to standard output. The default buffer size is 4 Mbytes (4194304 bytes in this case, not 4000000). Call it as buffer 42 to use a 42 Mbyte buffer. I use this program to buffer the PCM data extracted from RealAudioTM crap before feeding it to an MP3 encoder.
Implemented by a simple select() loop and a ring of buffers.
Source code: buffer.c.
Compile like this: gcc -O3 -o buffer buffer.c
How to reduce the verbosity level: buffer 2>/dev/null
Typical use:
URL=rtsp://www.example.com/encoder/1729.rm MINUTES=60 mkfifo audiodump.wav buffer < audiodump.wav | lame --quiet -b 128 - foo.mp3 & (sleep `expr $MINUTES \* 60`; echo "quit") | \ mplayer -really-quiet -ao pcm -vc dummy -vo null \ -slave -cache 500 $URL