Re: [LAU] Library for simple audio programming

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Wednesday, January 16, 2013 - 2:02 am

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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

This is the only confirmed message in this thread.
Possibly related messages: