I am currently working on a plugin that has a built in guitar tuner. I’ve already tested my algorithm for pitch extraction in Python, and now I’m ready to implement it inside the plugin.
This is what I need to do:
- Downsample the signal (down to 8kHz) (this is because I don’t need full band to tune a guitar, so I can lower the CPU load working at 8kHz instead of 44/48/96 etc)
- fill a buffer until I have 1024 samples
- make the FFT of the buffer, do stuff, make the IFFT, do other stuff and estimate the pitch
Since this is not related to the main signal processing, I would like to do it in a separate thread.
So, my question is: is there something in JUCE that has a similar implementation? if not, are there some “best practice” to follow for this kind of applications? I simply don’t want to reinvent the wheel and I would like to rely on robust and already tested code. For example for the FFT/IFFT part I know there is a dedicated class in JUCE, and I’ve also already used it in the past.
The two main problems now are the downsampling procedure (maybe is it possibile to use only the processSampleDown part of the oversampling class?) and the creation/management of the buffer and the separate thread.