[PD] soundfiler is slow; readsf~ no filelength

Samuel Burt composer.samuel.burt at gmail.com
Thu Nov 3 21:07:19 CET 2011

How do I get the length of an aif file without using soundfiler?

I've got an application that loads random aif and wav files from a chosen directory when triggered. I was using soundfiler to load a sound into an array where I could play it back with variable speed. When I ran two of these applications simultaneously, I noticed audio dropouts every time soundfiler would load a new sound. Soundfiler is not threaded, so I went looking for other people's solutions. Someone mentioned that Miller had suggested using readsf~ in an upsampled subpatch to read a sound into an array quickly. When you do this, how do you know how long to make your array to load in the sound? I suppose I could just make a preset length. I did see posts about wavinfo (buggy) and soundfile_info (only for wav files).

Is there a way to get the sample length of aifs in Pd without soundfiler?

This is an application I develop for someone else. It would not be appropriate for me to ask him to go through his entire collection of samples and change all the aifs to wavs. If I make the array an arbitrary length, he may be surprised when he starts trying to load in 2 minute files.

OS 10.6.8
Pd 0.42.5-extended-rc5

Samuel Burt

More information about the Pd-list mailing list