ofSoundPlayer: getSpectrum per frame number?

I guess its not possible but I ask anyways:

Is it possible to access the spectrum values for a certain frame? I am asking because I’d like to make a prerendered version for an audioReactive piece by saving every frame as a .png. That obviously makes the music go out of sync thats why I am asking.

Anyways if it doesnt work i will try to write the fft data to an xml file first.



i don’t really know how to solve this, but i’m also facing the same problem.
i was trying to send the play head to the position i want it to be but the spectrum read i get are all zeros.
have you managed to solve this??

when people do this in processing, does the same problem occur? if so, how do they solve it?


hi, i think i kinda solved this. dont know how precise it is, but is seems to sincronize well.

its actually very easy.

this goes in the setup function

//music.length/music.internalFreq will get the length of the audio in seconds.  
// multiplying by 30 because the video will have 30FPS  
totalFrames = floor(((float)music.length/music.internalFreq*30));  
counter = 0;  

and this in the update

// just normalize the frame counter using the total frames and we know   
// where we need to place the play head   
float playHeadPos = counter/totalFrames;  

i dont have any editing program but i made a video and audio player in OF and both audio and video seem to be well synchronized .


that seems to be a really easy method. what I did is that I wrote all the FFT data needed to an XML file and afterwards read the data for each frame.

I guess both is kinda easy amd quick.