I'm writing a library in ruby for dealing with audio data, and I'm faced with a design decision.
For several reasons, the best thing to use in ruby for numerical data is NArray[1] which is implemented in C for efficiency. So my code is basically a wrapper around NArray which gives some more specific functionality. I want to support multichannel data, and this is where the design decision comes. Most of the time I've seen code that handles multichannel information in an interleaved fashion (each frame is consecutive samples in the array), but I have once or twice seen channels placed end-to-end or in different arrays altogether. It will of course be possible to extract and/or merge channels to deal with libraries (e.g. libsndfile, which I will also be wrapping) or existing code that works one way or the other, but I wonder which should be the internal format to use. What are your thoughts? What is best practice on multichannel audio, or is it always application-specific? For a fluctuating peek (think CVS, although I use darcs) into what I'm doing, check out http://hans.fugal.net/src/ruby-audio 1. http://www.ir.isas.ac.jp/~masa/ruby/index-e.html -- Hans Fugal ; http://hans.fugal.net There's nothing remarkable about it. All one has to do is hit the right keys at the right time and the instrument plays itself. -- Johann Sebastian Bach
signature.asc
Description: Digital signature
