|No such thing as a small change|
Audio Stream Bufferby reds (Novice)
|on Jul 01, 2004 at 01:22 UTC||Need Help??|
reds has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings fellow monks.
I am writing a small little ditty that grabs an audio stream from one machine (using Audio Hijack Pro, if you're curious), pipes it over the network to a listening daemon which then plays said audio over a stereo. I'm working over an 802.11b network (higher latency than Ethernet).
My question arises from poor results I've been seeing. I can't figure out how to buffer a couple seconds of audio so that the bursty, lagged nature of the 802.11b transmission doesn't lead to buffer underruns in aplay. Right now I'm seeing an underrun every second or so. Nasty.
On the client side (sender), I've got a basic:
On the server side (receiver), I've currently got this:
I've seen some disucssion here about sysread() vs. read(), but I can't seem to figure out how I would dump the audio to AUDIO_OUT without print() (you're not supposed to mix buffered functions with unbuffered ones).
Any help would be greatly appreciated! Chris H.