0
$\begingroup$

Like the title says... I want to split audio file where a single instrument is played (not so fast)... I just need to detect the attack phase of the waveform to know where a played note begins. Can someone suggest a way to do this? It should be robust, not to react to isolated peaks... If there are open source implementations please share.... or even pseudocode is fine ? Cheers

$\endgroup$
  • 1
    $\begingroup$ Depends on the instrument. A new note may not necessarily begin with an attack on some instruments, such as a slide trombone or bowed string. $\endgroup$ – hotpaw2 Sep 12 '14 at 21:15
  • $\begingroup$ Yes, that's true, but my instrument is Piano or Guitar so the attack is clearly noticeable. For example like the begining of this waveform s21.postimg.org/mnyfbmldj/waveform.jpg $\endgroup$ – Alexander Sep 12 '14 at 22:22
0
$\begingroup$

If it is a single instrument playing without any background noise/instruments, then the problem becomes simple. All you have to do is keep track of energy, which is calculated at a defined window size (say 40 milliseconds). Wherever you see the energy increasing and sustaining for a while (you'll have to define how long a note is good for you to split your audio), you can mark the ascent of such an energy plot as the point to split.

You can also split audio when a particular note is played, for this you'll have to track energy in the respective spectrum band of the note you want to split the audio on. For example to track note A4 (a') which has 440Hz frequency. You might have to track the energy in a band around 440 Hz, say 420 to 460 Hz. Mind you, this splitting business based on notes played gets more complicated when complex notes are played.

Also, this problem gets really difficult when you have multiple instruments.

$\endgroup$
  • $\begingroup$ Thank you, I have done it with calculating RMS in windows size of 512 or 1024 samples and it works fine.... Satisfying results $\endgroup$ – Alexander Sep 14 '14 at 23:22

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.