Imagine you have a long recording of a guitar player playing an arpeggio at a slow speed. To simplify, assume the tempo is 60 bpm or lower. I want to annotate this recording with the exact moments when the guitar player plucks the strings. So:

$$ \mathrm{detect}(recording.wav) = \{t_1, t_2, t_3, \ldots\}, $$ where $t_1, t_2, \ldots$ are the millisecond offsets in the recording of when the strings are plucked.

I have skimmed similar questions related to beat and note detection but they are not really what I'm looking for. Beat detection doesn't work because I'm trying to detect when notes are played not beats. Note detection isn't right either because I'm only looking for when the note is played, not the frequency of it. Probably I'm missing something because this problem seem so trivial.

You can find examples of the recordings I'm talking about here:

The file-format happens to be mp3 but could just aswell be wav.

After some research, I've found that what I'm looking for is called "onset detection." I would have hoped that there would exist robust methods for detecting when the notes are played, since it is so easy for human ears to hear it. But perhaps that is not the case.

  • 1
    $\begingroup$ if this is a monophonic guitar lick (one note at a time), then envelope following and some threshold works okay. if you're also trying to detect the note pitch, besides the note onsets, then you need a pitch detector. a pitch detector will have a "confidence" or "periodicity" measure that tells you how pure the tone is of the note. when that confidence level goes low and the amplitude is suddenly higher (like the derivative of the envelope exceeds a threshold) then that's a good guess for a note onset. $\endgroup$ – robert bristow-johnson Jan 24 '19 at 21:53
  • 1
    $\begingroup$ those files aren't really monophonic because finger-picking allows strings to ring while others are being plucked. when the bass note is ringing out and higher strings are played, it may be difficult to see a sufficiently sharp attack on the quieter notes. i dunno, but i would still recommend simple envelope detection on the unfiltered sound and another envelope detection done on high-pass filtered. line up the two envelopes and see what you get. $\endgroup$ – robert bristow-johnson Jan 25 '19 at 0:26

Your Answer

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

Browse other questions tagged or ask your own question.