Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: GNU Octave audio package hacked for buffered reads (Read 5314 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

GNU Octave audio package hacked for buffered reads

Two zips attached.

"audio-1.1.4-hackedForBuffering.zip" contains "auopen.m", "auread.m", and "auclose.m", derived from "auload.m" in the audio-1.1.4 package bundled with Octave 3.2.4 (installed via Octave-Forge windows installer). The purpose of these three files is to implement a minimal API to read WAVs in a buffered (piecemeal) way as opposed to the all-at-once method that auload uses.

You're entirely on your own on how to "properly" install this thing, I just hacked files in-place at Octave\3.2.4_gcc-4.4.0\share\octave\packages\audio-1.1.4, which is a pretty naughty thing to do.

Note, the name here is kind of a misnomer, "audio-1.1.4-hackedForBuffering.zip" contains ONLY new .m files. (So don't delete your old "audio" package.)

My changes/API definition should be pretty brutally self-explanatory: I hold a "handle" data structure, returned by auopen(), which holds the file handle and all of the file header info necessary to actually read data. auread() returns a [buffer, handle] tuple (I am a total Octave noob so this is the brutally functional way I chose to update handle state through auread() calls). auclose() just closes the file.

File seeking is wholly unimplemented, and I never attempted to test or get working file reads through EOF (eg when the returned sample array is smaller than the requested sample array). I did fix the two's complement crap, and anything else that might have leered at me, but caveat emptor on all of this -- I got sufficiently fed up with Octave immediately after getting this working that I haven't made much of an attempt to maintain this, besides ensuring that it still runs.

"audio-hackedForBuffering-test.zip" contains the little ditty I wrote to test and validate the loader above, which is a barebones implementation of Welch's Method with 50% overlap and a Vorbis window. To test, unzip, make sure the unzip dir is on your octave path, run "ptest", and you should get a very believable spectrum plot of a sine wave, along with a numeric verification of Parsival's Theorem (comparing avg power as measured both in time domain and frequency domain to make sure the math checks out).

For any GNU homies, I'll attribute all of these changes to the same license that goes for the rest of Octave (GPL2 or latest GPL, right?)

ABSOLUTELY NO WARRANTY.