leozimmerman / ofxFilterbank

openFrameworks addon for polyphonic pitch detection in an audio signal
MIT License
28 stars 10 forks source link

filterbank.exit() crash #2

Open transat opened 8 years ago

transat commented 8 years ago

I'm using ofxFilterbank in a scene (through ofxAppUtils). When I'm moving through scenes, my app crashes on the filterbank scene unless i've stayed on the scene for about 4-5 seconds. But I don't get a crash if I comment out the contents of void ofxFilterbank::exit()

//    for (int i=0; i<channels; i++) {
//        for (int n=midiMin; n<midiMax; n++){
//            if (fdata[i][n]!=NULL ) free (fdata[i][n]);
//        }
//        free (fdata[i]);
//    }
//    free (fdata);

If I only comment out if (fdata[i][n]!=NULL ) free (fdata[i][n]); then I'm allowed to go past the scene without pausing but the app immediately crashes the second time I go to the scene. Any ideas what could be going wrong?

transat commented 8 years ago

In case it matters, I also have a ofRtAudioSoundStream: stream over/underflow detected warning in my console.

leozimmerman commented 8 years ago

Did you stop/closed the ofSoundStream before exiting the filterbank? No audioIn/audioOut func must be called after exiting the filterbank, maybe the error is related to this

transat commented 8 years ago

I didn't stop/close the ofSoundStream because I'd like it to continue on to the next scene, which doesn't include filterbank. So the way I had it, I close ofSoundStream in the ofApp's exit() function, unlike filterbank which I was closing in the scene's exit(). Am I doing this the wrong way? Should I exit filterbank in the ofApp instead or would doing that mean that it's tying up resources unnecessarily in some scenes? Sorry, I'm quite new to all of this!

transat commented 8 years ago

I have ofxAudioAnalyzer going across all the scenes, by the way, so if there's a way I can generate the filterbank visualisations with that addon instead then I suppose it would be even better for me. Is that possible?

leozimmerman commented 8 years ago

I dont know what audio info you need to visualize, with ofxAudioAnalyzer you can get several descriptors. Soon I-ll be updating the ofxAudioAnalyzer to be clearer and easier to use, the same happens with this addon. Honestly, the ofxFilterbank is still in a non manteined "beta" version, I plan to update it soon.

transat commented 8 years ago

I'd like to visualise the notes picked up by ofxFilterbank or preferably ofxAudioAnalyzer, in exactly the same way you have it in ofxFilterbank but also by displaying the notes on a piano or on guitar strings. Down the track, I'd like to be able to have the app guess which scales/chords are compatible with most of the notes being recognised. I'll wait for your tweaks though! Thanks for your great work.

leozimmerman commented 8 years ago

The ofxAudioAnalyzer hasnt have polyphonic functionality implemented yet. For monophonic pitch recognition you have two algorithms that may be useful for what you're doing. Pitch Freque detection and HPCP. See essentia library website for more info.