possible to detect multiple pitches at a certain spot?

Mar 23, 2012 at 6:55 PM

What would it take to make this engine detect multiple pitches from a given set of samples? I'm thinking to do it on my own where I detect a pitch, remove that pitch with a notch filter, and then pass the buffer in for another round of pitch detection. But is there some better mechanism to do this in the code you've already created?

Coordinator
Mar 24, 2012 at 5:33 PM

Unfortunately this algorithm is based off of auto-correlation, which doesn't look at individual frequencies, but looks for the number of samples at which point the waveform repeats itself. Thus one cannot extract multiple different frequencies from one such calculation. This is where an FFT approach would have been more useful, but it has other issues and I think for monophonic sources, this approach works better.

But as you suggest, removing the pitch with a notch filter might work. So once a frequency has been detected, you use a notch filter at that frequency and remove that from the source. Then do another pass and detect the next frequency etc. However note that such an approach could have a problem since this algorithm works best with sources that have one dominant frequency. If you pass in a guitar chord for example, all notes will have roughly the same amplitude and this might result in this algorithm not being able to lock onto any of the frequencies.

Another approach might be to break the input waveform into smaller frequency bands and send each band through the detector (each band would require its own set of internal buffers). But at that point, the added complexity might not be worth it and alternative algorithms might work better.

Mar 25, 2012 at 3:09 AM

I've been attempting the detect, remove, detect, remove, ..., with out much success. It definitely struggles on the complex areas of the music.

Coordinator
Mar 25, 2012 at 5:31 PM

Well this algorithm is definitely not designed to work on complex music. The docs specifically say that the source waveform needs to be monophonic. It can contains any number of harmonics (different octaves), but not frequencies that fall on other notes.