Okay, this question is going to show you just how audio illiterate I am, but here it goes anyhow.
I need to do some audio analysis. Simple enough. But I want to use saveFrame to save out screengrabs so I can piece together the result into a quicktime and then paste in the audio (Like I used to do with Sonia until my new Intel Mac rendered jSyn useless for now). So this means I need to do my analysis at a specified framerate instead of realtime.
I am porting over my code from Sonia and I am running into some problems.
1) With Sonia, I could say mySample.play(starttime, endtime) and play a specific portion of the total audio, but I cannot figure out how to do this with ESS aside from using cue(starttime) and trying to make it pause once endtime is reached. Is there a way to play the audio directly from a sample array of floats?
2) Right now, I am analyzing every 1/24th of a second of audio and then getting the FFT for that 1/24th of a second. I do that by copying over sample frames to my sample float array and then dealing with that. But is there a different easier way I am overlooking (that could possibly solve problem #1? See my code below.
Code:
void prepareClip(){
startTime = int(myTime * sampleRate);
endTime = startTime + sampleLength;
for (int i=startTime; i<endTime; i++){
sample[i - startTime] = myChannel.samples[i];
}
myFFT.getSpectrum(sample, 0);
myTime += (1.0/float(framerate));
}
Any help would be appreciated. Thanks.