Pitch Detection Algorithm

Hello everyone,

I'm new to Processing, and not an advanced coder. I am a guitar teacher, building some little serious games that interact with the notes instruments play. I'm used to work with Max/MSP, which is fine for "still graphics" softwares, but I'd like to migrate to Processing for creating more advanced graphical animations, for more artistic applications responding to the notes an instrument plays.

Here's my problem : on Max/MSP i'm using an object called sigmund~ which was built by Ted Apel and Miller Puckette and works fine for me. It detects notes from an audio signal and converts it to midi.

Do you know any library available in Processing that can do this job (capturing audio, detect pitch and convert to midi - or be used directly within Processing) ? I've seen a few things in these forums but didn't get enough information.

Thank you very much for your help, Thibault


  • Minim is a good library- look at that in the library section of processing.org Well documented

    Moreover since processing is java, you can in theory use any java library

  • Possibly check out the frequency functions in the minim analysis package


    also see TheMIDIbus midi library for Processing


  • Hello Chrisir and jeremydouglas, thank you for your answers. I already looked in this minim library, but didn't find what I looked for. I double checked it when you told me to dig in. FFT seems to be great but as far as I've read, it is not enough for accurate and robust pitch tracking. It needs to be used as a small part of an whole algorithm. (It's not an affirmation, it's what I read). I've read some things on this page : https://en.wikipedia.org/wiki/Pitch_detection_algorithm

    I'd like to be able to use YAAPT, RAPT or YIN in processing, via a Library... (Or any accurate and fast algorithm).

  • edited July 2017

    Well, here is an old AMDF implementation.

    ...but if you know which algorithm you want, you can implement your own on top of minim.

  • Thank you Jeremy, I'll check this one !

    About implementing another algorithm, this is where I'm stuck, I have no idea how to do it. But using minim would be a good idea, this solves a big part of the problem. I'm just too dumb in maths...

  • @ThibaultMuller===

    i have used a lot of times fft+minim for doing that; it works very well using fftLog (better than fftLin). As for midi as jeremydouglass said theMidibus lib works fine, but it s also possible to use directly java, javax.sound.midi.

  • I've dived into the code @jeremydouglass suggested. I think I've understood most of the structure of the autocorrelation method (up to the maths for which I'll have to trust the author). I'll try to use it as it's built !

    I still need another part of the code, which would be "note detection" : processing detecting a note has been played and then retrieve the pitch. For now, with this code, the program is constantly estimating the pitch of the microphone. I'd like it to be able to detect the stronger notes and convert it to midi note on and off. Do you know some code that could give me hints ?

    Thank you again !

Sign In or Register to comment.