# how can I calculate pitch deviation in a large collection of audio files?

I am making a software model of an existing digital synthesiser and I have made audio recordings of single notes with particular parameter settings. I made a program in C++ which sends a MIDI sysex message to change the parameter in question, then triggers a MIDI noteon and noteoff message. The sound is recorded to a wav file. So I have several collections of 100 wav files for each parameter (the parameters in question have 100 steps).

One of the (easier) parameters I am looking at is LFO depth. The LFO is applied to the oscillator pitch. So I have 100 wav files with a square wave LFO modulating the oscillator pitch between a base pitch and another pitch that goes between base pitch (zero modulation) and base pitch+1 octave. I would like to write a script to work out precisely how many semitones/cents modulation occurs in each wav file. So I would like to end up with 100 numbers that I can use to map to modulation depth in my software model.

Can anyone recommend a tool/and or libraries for doing this task?

• Interesting question. Could you share one of the wave files so that we may use it to experiment? Aug 11 '13 at 19:50
• What is the approximate ratio between the pitch frequency and the LFO frequency? Big or small? Aug 11 '13 at 20:17
• need a pitch detector. there are better pitch detectors than YIN. but they might not be publicly available nor free. Jan 10 '14 at 2:44
• If you already have working software could you perhaps approach from the other side i.e. generate wavs from your software and cross correlate with the measured source wavs to build a rough model? Mar 10 '14 at 8:41

## 2 Answers

Use a very slow LFO to get very long segments of uniform pitch (this will allow you to use long analysis windows and counter 'border' effects), and use the simplest possible waveform for the oscillator to prevent octave errors in pitch detection. Aubio provides an implementation of the YIN algorithm which is fairly accurate.

I personally doubt there's anything fancy going on here - it is very likely that the relationship between the LFO modulation depth and the pitch deviation in cents is linear.

I think that you can find some tools here: Vamp Plugins. These plugins can run standalone or in Sonic Visualizer. You also have Aubio plugin, mentioned by pichenettes, or ones created by guys at University of Barcelona (based on Pitch Contour Characteristics - more to read in the publication of J. Salamon and his thesis). I am sure you can find something for you in there.