Ivan K writes:
> I want to write a simple application that can open a .wav file
FWIW, this task is incredibly easy in SuperCollider:
// Open an existing sound file
// Automatically parses the header
f = SoundFile.openRead(Platform.resourceDir +/+ "sounds/a11wlk01.wav");
// Jump ahead to a given "sample frame"
// f.sampleRate "frames" always corresponds to 1 sec,
// no matter how many channels
f.seek(4410); // 0.1 seconds in
// Allocate space for the samples, and get them
// Channels are interleaved
d = FloatArray.newClear(50);
f.readData(d);
f.close;
// Push them out to a text file
o = File("~/samples.txt", "w");
d.do { |sample| o << sample << Char.nl };
o.close;
It's also possible to rework this (fairly minor adjustments) to run it from the
commandline. No time to do it at the moment -- maybe later, if anyone is
curious.
hjh
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.