Streaming audio data through a file without making a huge file

Forum: LinuxTotal Replies: 4
Author Content
Bob_Robertson

Sep 12, 2012
11:14 AM EDT
Ok, here's the thingie.

I have a telephone media server that is running on Linux. The VoIP switch accesses this media server for such things as "Music On Hold", conferences, etc.

The Music On Hold files that came with it are.... pathetic.

The boss wants a cheap (ahem) way to take some stream of data, for example the 16kbps stream from LRN.fm (my example, not his), and make it available as Music on Hold.

The media server is expecting a .WAV file with specific attributes which I can recreate but don't remember off the top of my head.

So here's what is in my mind, tell me if I'm out of my mind.

wget://LRN.fm:16/ | lame -b 128 -o output.wav, but have output.wav be not a real file but something like a pipe itself that is constantly dumping its output not to disk, but simply into nothing. That way the file output.wav never grows.

Then, when the media server is asked to serve up output.wav, what is served is whatever is being received at that moment.

There is so much streaming content that I know this is not impossible, I just do not know enough about pipe functions in *NIX to implement it.

Thank you for any pointers or constructive/funny suggestions people may have.
skelband

Sep 12, 2012
1:00 PM EDT
How about a fifo for the wav file?

man mkfifo
Bob_Robertson

Sep 12, 2012
1:04 PM EDT
Skelband, indeed, that's what someone else came up with. The other guy has already tried that, and for some reason it's not working.

Funny thing, as soon as he said "fifo" not 5 minutes ago, I said "Yes, that's what I had in mind", because I have known about them, I just couldn't remember the phrase.

Anyway, the back to find out what he's doing, maybe I can make a constructive suggestion. :^)
skelband

Sep 12, 2012
1:27 PM EDT
The only problem I could think of was what would happen if no-one was reading the pipe.

Would it buffer up and block the writer?

I wish I had the time to try it out.....
Bob_Robertson

Sep 12, 2012
1:29 PM EDT
Ok. It looks like the best "answer" is something to the effect of,

mkfifo bob1.wav

sox audiofile.wav (sox bitrate settings to match phone system expectations) -t wav > bob1.wav

Unfortunately, although my coworker has reached this point, his door is shut and I don't walk in on him. I'm very much willing to accept that the phone switch just won't tolerate this no matter how "standard" it is, so the truth of the matter is that unless it somehow works, I can't even tell what's broken. The phone system media server doesn't have its own sound card.

You cannot post until you login.