Understanding YIN pitch detection

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Can anyone point me to a good resource that might help me better understand the YIN pitch detection algorithm. I'm less interested in how it works internally, and more interested in how to use the functions from this library:

http://aubio.org/

There are parameters that I have to set that I don't quite understand. I have read some of the original paper on the YIN algorithm, but it's quite heavy going.

Anyone care to explain it in more "layman" like terms?

Thanks

Post

The original paper is the best place to gather information about its parameters.

your window size should be set to be at least twice the longest period in your audio file and you can play with the threshold to avoid octave errors or cope with noisy/inharmonic sounds

what you get is a triplet period,(in)harmonicity, energy for each frame.

Post

Ok, fair enough. I have made some more effort to read and understand some of the paper.

I understand the point about the minimum window size. What is a reasonable frequency to assume is the lowest my program will receive? 30Hz? 20Hz? It can potentially be fed ANY audio clip that the user wants.

Regarding the specific implementation I am going to be using (at least for the moment), I still am not 100% clear on which parameter (in code) relates to which parameter in the paper.

When creating a new "pitch detection object", i use the following function:

Code: Select all

aubio_pitchdetection_t* new_aubio_pitchdetection (uint_t 	bufsize, 
uint_t hopsize, uint_t channels, uint_t samplerate, 
aubio_pitchdetection_type type, aubio_pitchdetection_mode mode)

Parameters:
bufsize 	      size of the input buffer to analyse
hopsize 	      step size between two consecutive analysis instant
channels      number of channels to analyse
samplerate  sampling rate of the signal
type 	      set pitch detection algorithm
mode 	      set pitch units for output
And then I use the following function to actually perform the detection on a section of data:

Code: Select all

smpl_t aubio_pitchdetection (aubio_pitchdetection_t * p, fvec_t * ibuf)

Parameters:
p 	   pitch detection object as returned by new_aubio_pitchdetection
ibuf    input signal of length hopsize
I am a little confused about "hopsize" and "bufsize". It seems to me that "hopsize" is equivalent to window size. What, then, is "bufsize" ? I am using this code to write an offline cmd line app, so latency is not an issue, nothing is being done in real time (if that mattters).

Can anyone help me shed some light on this?

Post

Sorry to bump this 3 years old thread, but i'm running in the exact same problem, for my level of programming it is way to complex, did you manage to do it ?

I would really like to use YIN to get the frequency of the sound ( i'm also building a guitar tuner ) , but aubio is very hard to understand.

Thanks
Pat.

Post

That thread is horribly misnamed. It has nothing to do with understanding nor with YIN. It is all about basic programming and demanding to be spoonfed the workings of a simple and even documented API. Anyway ...
Patricia58 wrote:Sorry to bump this 3 years old thread, but i'm running in the exact same problem, for my level of programming it is way to complex, did you manage to do it ?

I would really like to use YIN to get the frequency of the sound ( i'm also building a guitar tuner ) , but aubio is very hard to understand.
What's not to understand about http://aubio.org/doc/pitchdetection_8h.html ?

1. Get a new aubio_pitchdetection_t object. This is done via new_aubio_pitchdetection (...)
2. Use the new object in aubio_pitchdetection (...)
3. (Optional) Set the YIN threshold in aubio_pitchdetection_set_yinthresh (...)
4. (Only for advanced power users) Clean up by deleting the created YIN object with del_aubio_pitchdetection (...)

Now if you don't get any of those 4 points your level of programming does not exist and you should take up beginners classes again (or for the first time).

If you are having problems with the API itself or its documentation contact the appropriate person found in the documentation. In case you never seen the documentation here is the link http://aubio.org/doc/index.html

Sorry if this sounds harsh ... but calling 4 simple functions "way to[sic] complex" and "hard to understand" suggest problems with actually being able to read and comprehend documentation. Because of either the complete inability to understand C or the complete lack of wanting to understand C. Unless this is fixed you will never understand how to use anything.

Post Reply

Return to “DSP and Plugin Development”