leozimmerman / ofxAudioAnalyzer

openFrameworks wrapper for Essentia. Audio analysis algorithms in real-time
GNU Affero General Public License v3.0
183 stars 37 forks source link

Program hangs on AudioAnalyzer::analyze #23

Closed skylarbarrera closed 4 years ago

skylarbarrera commented 4 years ago

My SoundBuffer is being initialized and updated correctly but once I try to run AudioAnalyzer::analyze(SoundBuffer) my program hangs and my audio buffer freezes with all 0's I followed the example but they are using older versions which ask for a SoundBuffer as an input.

`{void ofApp::audioIn(float * input, int bufferSize, int nChannels){

float buffer1[bufferSize];
float buffer2[bufferSize];

for(int i = 0; i < bufferSize ; i += 1) {
    buffer1[i] = input[i*nChannels];
    buffer2[i] = input[i*nChannels+1];

}

//Feeding float array into a SoundBuffer
pop.copyFrom(buffer1, 512, 2, 44100);

audioAnal.analyze(pop);

}`

skylarbarrera commented 4 years ago

Digged into a different example and found the following audioIn function that solved the problem and is the correct way to set it up.

void ofApp::audioIn(ofSoundBuffer &inBuffer){ //ANALYZE SOUNDBUFFER: audioAnal.analyze(inBuffer); }