Understanding YIN pitch detection
-
- KVRist
- 55 posts since 10 Jul, 2010
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
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
-
- KVRian
- 626 posts since 29 Jul, 2003 from Paris - France
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.
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.
-
- KVRist
- Topic Starter
- 55 posts since 10 Jul, 2010
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:
And then I use the following function to actually perform the detection on a section of data:
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?
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
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
Can anyone help me shed some light on this?
-
- KVRer
- 2 posts since 18 Jun, 2013
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.
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.
-
- KVRer
- 13 posts since 26 Apr, 2013
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 ...
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.
What's not to understand about http://aubio.org/doc/pitchdetection_8h.html ?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.
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.
