Appending soundfiler hack

Appending soundfiler external

For another project in progress, I required an object that can read a large audio file into an array, process the data and write it back to a file. The audio files are quite large, about one hour of 44100Hz, 2-channel, so to make proper indexing possible with 32-bit floats, the data should be processed in smaller chunks. The soundfiler object allows just this with the extra benefit it is not a tilde object, so reading is faster than "real-time".

Alas the write part of soundfiler is limited to one write action per file. So there is no way to append data to an existing file.

Searching for an object with such behaviour did not yield anything, while studying the soundfiler code and the c-library documentation indicates it should be possible.

The first version of the object, for now called "soundfilera", is very rudimentary, and just does the minimal to be useful. It can only write WAV files, and doesn't even check the existing file is of the correct type, sample size or sample rate. Internally, it is "throw-away code", meaning it duplicates a large part of the write function, instead of properly integrate the new "append" functionality. These defects are left to a later version if it is ever required. To make it usable next to the original soundfiler the main object is renamed to soundfilera and the code for readsf~ and writesf~ is removed.

The original source is copyrighted by Miller Puckette and others. What I added are only a very few lines of code. Most are copied. The original LICENSE.txt is included in the package.


Latest update: 2013-11-08

email: fjkraan@xs4all.nl