Pitch recognizer C++ API


#1

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?

Thanks


#2

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

http://aubio.org/doc/files.html


#3

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


#4

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


#5

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


#6

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

[quote]Full Feature List
[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[/]
[]Looping[/]
[]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[/]
[]…[/][/list][/quote]

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


#7

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

http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=8297


#8

Has anyone found a good solution for this ?


#9

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


#10

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)


#11

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.


#12

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?


#13

doing the phase difference at that bin between 2 successive fft


#14

Oh brilliant. That’s super helpful…


#15

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…


#16

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


#17

http://sites.uci.edu/computermusic/2014/09/22/sigmund-for-pitch-tracking/

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


#18

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


#19

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.


#20

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