From: Hans Fugal Date: 2005-11-15T23:17:17+09:00 Subject: Re: RFC: Audio On Tue, 15 Nov 2005 at 04:58 -0500, Jay Levitt wrote: > > My plans for this are simple: wrap libsndfile, libsamplerate, and > > possibly portaudio. Combined with ladspar, midilib, and other ruby audio > > libs that exist, this should get us well on the way. > > Looks really good, and the NArray interface is simple. What do you > think about wrapping libmad? Possibly, after all the others. > I need to write a simple utility that monitors a streaming audio server > for silence, and pages me when it detects an outage. Seems like all I > need is libmad and some code to detect a bunch of zeros... perfect for a > simple ruby script, if the bindings were there. Ya? > > Ah, but how does NArray deal with the constant resizing resulting from > an ongoing stream? Is there a copy each time? I'm not sure how libmad's interface is, and I've never really done streaming before, but to my understanding you would generally want to decode a fixed amount each 'period', since that's how you're going to feed it to the soundcard anyway. You could always do a 'big enough' array and fill it partially if needed. You could probably do this now if you use mpg123 and/or sox and output to a raw format on stdout and read that into an NArray (or you can be a tester for the Audio class - it works now, but the API is still subject to change).