How can I get the FFT of an audio source at a specific time

Viewed 39

I have this code here to connect my source->Analyzer->Speaker

But Im starting the source with source.start() I belive my problem is there,

how can I change it to just analyze source at time = 3 seconds.

 source.connect(analyser);
 analyser.connect(audioCtx.destination);

 source.start();

// I have this section VVV runing with a push of a button. It responds with the FFT at the time I pressed the button

 var bufferLength = analyser.frequencyBinCount;
 var dataArray = new Uint8Array(bufferLength);
 analyser.getByteTimeDomainData(dataArray);

 console.log(analyser);
 console.log(bufferLength);
 console.log(dataArray);
1 Answers

I did not test, but maybe you can pass the offset and duration to .start().

source.start(0, 3, 1); //start in 0 seconds, at time 3 seconds, play for 1 second
Related