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
Thanks, Samuel Burt
I think there is iemlib/soundfile_info.
.hc
On Nov 3, 2011, at 4:07 PM, Samuel Burt wrote:
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
Thanks, Samuel Burt
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Computer science is no more related to the computer than astronomy is related to the telescope. -Edsger Dykstra
Thanks, Hans, but iemlib/soundfile_info is also giving me the error. soundfile_info_read-error: /filepath/growl.oeoeoe.01.aif is no RIFF-WAVE-file
Sam
On Nov 3, 2011, at 4:57 , Hans-Christoph Steiner wrote:
I think there is iemlib/soundfile_info.
.hc
On Nov 3, 2011, at 4:07 PM, Samuel Burt wrote:
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
Thanks, Samuel Burt
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Computer science is no more related to the computer than astronomy is related to the telescope. -Edsger Dykstra
Le 2011-11-03 à 19:04:00, Samuel Burt a écrit :
Thanks, Hans, but iemlib/soundfile_info is also giving me the error. soundfile_info_read-error: /filepath/growl.oeoeoe.01.aif is no RIFF-WAVE-file
I made this patch (attached) that does it either the long way (for current releases of GridFlow) or the short way (with a feature I re-added to GridFlow today).
The trick is to open the file, skip the first 22 bytes, and then read the next 4 bytes as a 32-bit number with the most important byte first («big-endian»).
However, because the command for reversing the order of the bytes was missing, I had to make my own converter by taking 4 separate bytes...
Anyway. Now you have something that works, and it's easy to add to your patches. It does basically the same thing that [soundfiler] does, but without reading the actual sound.
You need to install GridFlow from http://gridflow.ca/
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
Here's the actual attachment...
Le 2011-11-03 à 21:18:00, Mathieu Bouchard a écrit :
Le 2011-11-03 à 19:04:00, Samuel Burt a écrit :
Thanks, Hans, but iemlib/soundfile_info is also giving me the error. soundfile_info_read-error: /filepath/growl.oeoeoe.01.aif is no RIFF-WAVE-file
I made this patch (attached) that does it either the long way (for current releases of GridFlow) or the short way (with a feature I re-added to GridFlow today).
The trick is to open the file, skip the first 22 bytes, and then read the next 4 bytes as a 32-bit number with the most important byte first («big-endian»).
However, because the command for reversing the order of the bytes was missing, I had to make my own converter by taking 4 separate bytes...
Anyway. Now you have something that works, and it's easy to add to your patches. It does basically the same thing that [soundfiler] does, but without reading the actual sound.
You need to install GridFlow from http://gridflow.ca/
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
I installed a new version of gridflow. I'm happy to say it is so much easier to do than it used to be.
Gridflow is giving me this message: error: method 'endian' not found for inlet 0 in class '#io.grid'
When I search for the error, Pd goes here:
It highlights the receiving of $0-placeholder. Any idea why?
It isn't giving me the number of samples, yet. It just prints the error and outputs 0.
Samuel Burt
On Nov 4, 2011, at 2:29 , Mathieu Bouchard wrote:
Here's the actual attachment...
Le 2011-11-03 à 21:18:00, Mathieu Bouchard a écrit :
Le 2011-11-03 à 19:04:00, Samuel Burt a écrit :
Thanks, Hans, but iemlib/soundfile_info is also giving me the error. soundfile_info_read-error: /filepath/growl.oeoeoe.01.aif is no RIFF-WAVE-file
I made this patch (attached) that does it either the long way (for current releases of GridFlow) or the short way (with a feature I re-added to GridFlow today).
The trick is to open the file, skip the first 22 bytes, and then read the next 4 bytes as a 32-bit number with the most important byte first («big-endian»).
However, because the command for reversing the order of the bytes was missing, I had to make my own converter by taking 4 separate bytes...
Anyway. Now you have something that works, and it's easy to add to your patches. It does basically the same thing that [soundfiler] does, but without reading the actual sound.
You need to install GridFlow from http://gridflow.ca/
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC<aiff.pd>
Le 2011-11-06 à 08:38:00, Samuel Burt a écrit :
I installed a new version of gridflow. I'm happy to say it is so much easier to do than it used to be.
I don't know which old version you are referring to.
Gridflow is giving me this message: error: method 'endian' not found for inlet 0 in class '#io.grid' When I search for the error, Pd goes here: It highlights the receiving of $0-placeholder. Any idea why?
GridFlow reports the error as coming from [#io.grid], which is a plugin for the [#in] (and [#out]) abstractions. The $0-placeholder subpatch holds whichever object is created when you send «open», to handle your file or device, and when you send «close», it replaces it by a dummy object that just prints «not open».
It isn't giving me the number of samples, yet. It just prints the error and outputs 0.
I said that the support for «endian» was added (back) a few days ago. Therefore, it is not in packages. The latest published packages were made in february.
The patch contains two versions of the same thing, and the bigger of the two is the workaround for when «endian» is not supported yet.
I don't know how you can get 0. When I got the error message, I also got a very wrong value that wasn't 0. Do you really get 0, or no value ? use [print]. All the messages in the messagebox is important, and part of their order is important (open first, then configure the reader, then use bang to read, then close).
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC