FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Sound
(Moderators: pitaru, REAS)
   Sonia read() syntax
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Sonia read() syntax  (Read 381 times)
jkeirstead

WWW
Sonia read() syntax
« on: Aug 13th, 2004, 8:14pm »

Hi,
 
I'm trying to display an entire wav file in the way you might see in a sound editing program.  I've got the read() function to work fine in most cases but it runs out of memory for really big files (50 MB or so).  
 
So instead, I'm using read(data array, startIndex, startFrame, numFrames) to select the values from a few key frames.  However when I do this, I keep getting array index errors.  
 
For example, if I want to take a big wav file and sample the read() values at 100 intervals, I use the following, where conv is a conversion factor = mySample.getNumFrames()/100.
 
Code:
for (int i=0;i<100; i++) {
  mySample.read(data,i,int(i*conv),1);  
}

After playing around a bit I discovered that it crashes when the third parameter, int(i*conv), exceeds 99, suggesting that it's trying to index the data array with the sample array parameter.  But according to the help files, this should be a sample value and in a file with several million samples, it doesn't seem right that it would crash on 99.
 
Anyone know what's going on?  I tried reversing the 2nd and 3rd parameters to see if the help file had just swapped the values and although it will run that way, it just reads the first 100 samples.
 
Thanks for your help,
James
 
pitaru


WWW Email
Re: Sonia read() syntax
« Reply #1 on: Aug 13th, 2004, 9:18pm »

Hey James, this sounds like a nasty bug - sorry. i'll take a look into it soon! Please allow me a week, as i'm away setting up an exhibit.
 
amit
 
Pages: 1 

« Previous topic | Next topic »