My goal is to extract a melodic respresentation for monophonic signal like voice.

I have used YIN algorithm to find the pitch of the signal. Now I want to detect notes from the pitch values (like they will change when a note change and become stable when it does not change). So my goal is to segment pitch values into notes so basically I have to:

  • split the different sung notes within voiced segments.
  • assign a constant pitch value to each estimated note.

So what should be my approach after the pitch estimation ?

(As i have very few DSP experience so I would like a detailed answer. Thank you)


1 Answer 1


okay, so 9 hours ago i posted in a comment links to other questions/answers regarding this topic for you to maybe pre-digest.

this is the issue of audio-to-MIDI conversion, which has been discussed, particularly among the Music Information Retrieval(MIR) people. it's not a perfectly solved problem, especially for anything polyphonic. even picking apart a duet is hard.

for monophonic, it's not so hard to get a decent pitch contour plot (that is the detected pitch vs. time) along with a plot for amplitude vs. time and a plot for pitch confidence or tone harmonicity (or the degree of periodicity of the note waveform) vs. time. there are other measures that one can do, such as a few different timbre parameters (like brightness, even/odd harmonic energy ratio).

what would be interesting maybe for you to do is, with your favorite monophonic test file (people often use Tom's Diner from Suzanne Vega) and see what pitch contour you get from YIN. and compare that to the pitch contour you get from using the ASDF (turned into autocorrelation) and peak picking from my other answers:

Fast pitch recognition

How to deal with low fundamental when using AMDF for pitch extraction?

What is an AMDF?

What is the difference between pitch detection and Onset detection?

so first make sure you get a decent pitch contour for your monophonic voice and see if the "octave errors" get patched up before looking for note onsets.

for many notes, the onset is clear by looking at sharp transitions in the amplitude contour curve and in the "harmonicity" curve. but if you're humming and not having any impulsive or sharp beginnings to notes, these curves make it hard to detect note onsets. sometimes then you need to look at somewhat sharper pitch transitions and also when the pitch crosses semi-tone boundaries. but somehow you don't want vibrato to trigger new notes if the vibrato happens to bring your note a little closer to another pitch in the 12 notes per octave scale.

finally, once you do effectively segment your notes, then you need to look at the pitch contour and decide, closer to the note onset, which of the equally-tempered, $\frac1{12}$ octave pitches you are closest to. but that can have a pitch offset if the whole song is a little sharp or a little flat (but the notes are well tuned to each other).

  • $\begingroup$ So from the answer : 1-:I need to get a good pitch curve, 2-: After the pitch curve i have to detect onsets from that(Should i make a running average of pitch and try to find if any pitch value gets higher than the average and detect that an onset ?), 3-: So for each onset change i should get a new note ? 4-:I have to convert the pitch values associated with each note to note values ?........clear me in this things. Thanks $\endgroup$ Sep 24, 2017 at 13:57
  • $\begingroup$ Also i would appreciate if you know of any publications that convert pitches to notes. $\endgroup$ Sep 24, 2017 at 13:58
  • $\begingroup$ do you know the MIDI pitch scale with A440 = MIDI Note 69? and do you know that pitch is the logarithm of the fundamental frequency? (and the fundamental frequency is the reciprocal of the period that you get from AMDF or ASDF or autocorrelation or YIN?) MIDI pitch is: $$ p = 69 + 12 \cdot \log_2 \left( \frac{f_0}{440 \mathrm{Hz}} \right)$$ where $f_0 = \frac1P$ is the fundamental frequency and $P$ is the period. $\endgroup$ Sep 25, 2017 at 2:50
  • $\begingroup$ first thing, Nazmus is to get a good pitch contour and do something to patch the octave errors or similar blips in what should be a smooth curve. then you will need to detect note onsets (and *"off"*sets to get the MIDI Note Off message defined). then, for the possibly varying pitch between the onset and offset, you need to make a commitment for what note was intended. usually you emphasize the pitch soon after the onset and model any drifting or glissando as a MIDI Pitch Bend. on the pitch contour (after patching errors), you might want to low-pass filter out the vibrato. $\endgroup$ Sep 25, 2017 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.