Welcome Guest ( Log In | Register )

> Upload forum rules

- No over 30 sec clips of copyrighted music. Cite properly and never more than necessary for the discussion.

- No copyrighted software without permission.

- Click here for complete Hydrogenaudio Terms of Service

GNU Octave audio package hacked for buffered reads
post May 30 2011, 02:04
Post #1

Group: Members (Donating)
Posts: 1985
Joined: 4-January 04
From: Austin, TX
Member No.: 10933

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?)


This post has been edited by Axon: May 30 2011, 02:06
Attached File(s)
Attached File  audio_1.1.4_hackedForBuffering.zip ( 3.98K ) Number of downloads: 125
Attached File  audio_hackedForBuffering_test.zip ( 6.1K ) Number of downloads: 132
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 4th May 2015 - 03:04