Using Overtone for vocal pitch detection

195 views
Skip to first unread message

pepijn (aka fliebel)

unread,
Jul 21, 2013, 5:23:04 AM7/21/13
to over...@googlegroups.com
Hey,

Would it be possible to use Overtone for vocal pitch detection?

I'm reading about this stuff, and there seem to be 2 dominant techniques: cepstrum and autocorrelation.

Cepstrum seems to be specific for vocal detection, while autocorrelation seems to be the best general purpose pitch detection,

There is a pitch ugen which uses autocorrelation, I tried

(definst test [] (sin-osc (pitch (in 8))))

That works sometimes, but it frequently picks an octave or other random note. Apparently a common problem with autocorrelation.

I also found mfcc, but I'm not sure exactly what it does and how to use it.

I know SC has a lot of FFT Ugens: http://danielnouri.org/docs/SuperColliderHelp/UGens/FFT/FFT%20Overview.html but AFAIK cepstrum needs the logarithm of the FFT which doesn't seem to be there.

(I also completely forgot how to get data from SC to Clojure, probably via buffers)

Any ideas?

Pepijn

Roger Allen

unread,
Jul 21, 2013, 5:58:28 PM7/21/13
to over...@googlegroups.com
I'm not sure how to make this work, but I can say that Jeff Rose made the code for the gui.scope spectrogram here https://github.com/overtone/overtone/blob/master/src/overtone/gui/scope.clj#L171 and that shows how to use the FFT ugen to get data in a buffer.

I've been playing with it in shadertone here https://github.com/overtone/shadertone/blob/master/src/shadertone/tone.clj#L74  [It is work-in-progress, so any feedback is welcome]  One note is that I keep the data in linear space since I found that is easier to map for graphics.  Jeff's code puts the data in logarithmic (dB) space.

Both send the FFT ugen data to a buffer for display.  I believe you could examine the buffer in Clojure and do pitch detection.  I find it fun to watch a "whistle" move around on the spectrogram and that would be simple to detect, I think.  Voice would be much more challenging...and rewarding!

Hope this helps,

Roger
Reply all
Reply to author
Forward
0 new messages