On Fri, 6 Jul 2001, Aleksei Guzev wrote: > # i wrote an extension called wavlength (it's on raa). it > # works, and here's how: > # "myWavFile.wav".wavlength > > Adding "WavFile" class seems to be better. Add method wavlength to the > class. And add constructor of that class from String. Derive it from > File. Maybe later You would add methods to play the file :) I think this is a good idea and that I'd like to participate somewhat to that. Here's a simple interface I suggest, which is similar to the one I've done for Linux::SoundDSP. I don't know the WAV format in particular though. #bits returns 8 or 16, the number of amplitude bits per value. #channels returns 1 for mono, 2 for stereo; the number of amplitude values per sample. #samples would return the number of amplitude samples. For an uncompressed file, this should be about: (file_size - headers_size) / (channels*bits/8) #rate would return the number of samples per second (hertz). For WAV, this is usually either 44100, or 1/2 of that, or 1/4 of that, but other formats (and soundcards) support a more continuous (and/or wider) range. #duration (would be the equivalent of current String#wavlength) would return something like: samples.to_f / rate matju