Pitch recognizer C++ API

Hi there,

I’m looking for a straightforward pitch recognizer C++ API (like every real tuner do). Does anybody here know how to find this kind of API?

What I would like to do is basically extract the fundamental frequency from a given wave sample (in real-time), then convert it to the closest pitched note, and finally into a proper NoteOn MIDI signal.

I already tried to Google it, but I haven’t found anything so far.

Any ideas?


Ok I think I finally found out some interesting stuffs here:


Hey, how’s the beat detector in that lib?

I have no idea unfortunately, but the lib sounds fine, you shouldn’t have any issues.

Aubio’s beat tracking was tested in the 2006 Mirex. Check the results for Brossier: http://www.music-ir.org/mirex/wiki/2006:Audio_Beat_Tracking_Results

I believe you could “grab” it (along with, why not, other interesting features) from Mixx:

[quote]Full Feature List
[]Cross-platform (Windows XP/Vista/7, Mac OS X, Linux)[/]
[]Free and open source (GPL v2)[/]
[]Parallel waveform displays[/]
[]Waveform summaries[/]
[]MP3, OGG, WAVE, and FLAC playback[/]
[]Extra playback formats through plugins[/]
[]Fast, database-powered library[/]
[]Shoutcast and Icecast broadcasting[/]
[]Automatic crossfading with Auto DJ[/]
[]Crates and playlists[/]
[]Reads iTunes and Rhythmbox libraries[/]
[]Pitch-independent time stretch (key lock)[/]
[]Vinyl emulation[/]
[]Hot cues[/]
[]Wave recording[/]
[][color=#FF0000]BPM detection and estimation[/color][/]
[][color=#FF0000]Bulk BPM analysis[/color][/]
[]Multichannel soundcard support (playback and capture)[/]
[]Multiple soundcard support[/]
[]Adjustable EQ shelves[/]
[]Crossfader curve control[/]
[]Skinnable interface with extra skins bundled[/]
[]Advanced MIDI scripting engine[/]
[]Multiple simultaneous MIDI controllers[/]
[]Adjustable pitch range[/]
[]Ramping pitchbend controls[/]
[]Multi-core CPU support[/]
[]24-bit/96000 Hz playback and capture[/]
[]Crystal clear audio[/]
[]Hardware video acceleration[/]

BTW, as I always suggest, collaboration is better than “stealing” !

Also - if you want a quick and easy one that uses FFT peak (on mac only - accelerate framework), take a look here:


Has anyone found a good solution for this ?

I put some pitch detection code here, that I use in the app I am currently working on: https://github.com/adamski/PitchDetector

Adam that YIN stuff is the best solution around I seem to remember??

PS. I don’t think FFT would be a good solution here. Presumably it’s woefully inaccurate for low pitches … (actually just found some analysis of how inaccurate: http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html)

Yes FFT / frequency-domain based pitch detection is generally much faster than time-domain, but tends to be less accurate. Peak picking FFT is the least accurate, and can completely miss the fundamental frequency.

In my tests, I found the the McLeod Pitch Method faster and more accurate than YIN.

How would you even do accurate FFT anyway? Even given a steady pitch, if the tone you’re dealing with is doesn’t fit nicely into a bin is there any way of working out what the pitch actually was?

doing the phase difference at that bin between 2 successive fft


Oh brilliant. That’s super helpful…

Here is an FFT-based pitch detection method in a JUCE plugin, using “Non Linear Least Square Estimator”: https://github.com/junilyd/Pitch-Estimator-Plugin

I’ve been meaning to borrow the code and try it out in my project…

Hi all,
I am looking into all this stuff.
A friend asked me to build a bass synth VST for him.
I made a simple application using PYO that used Yin and an envelope follower.
It worked pretty well. I had to mess around to get it to work.
A buffersize of 1024 with a window size of 3072 at 96k seemed to work best but it didn’t work at all below 50hz ( ie the bottom 4 notes on the low E string weren’t recognized. I wonder if the MPM method would work better that low. I guess the lower down you get the bigger the errors get. A couple of HZ is almost a semitone/half-step down there … I set the minimum freq yin was looking for to 10hz and applied a hi pass filter at 1000k … I managed to build a simple sampler in JUCE totally in C++ but getting on of these complicated algorythms to work seems a bit beyond my skills … I wish JUCE would compile PYO properly which was 7 lines of code … All the books I read seem to go from a description of DSP of a sine wave to rocket science. It would be nice if someone could suggest an easy way in. I also want to try and implement a PSOLA algorithm I made easily in JUCE. … Sean


follow the links, and you’ll be taken to the github repo for sigmund. it’s in C…

You need a much larger buffer size to capture lower frequencies. Try 4096 or 8192 or even larger, depending on your sample rate.

Thanks Adamski I will try it out. I would think that might add too much
latency when tracking for a jazz musician to use live.

How do those octave pedals bass players and guitar players use work?