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
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.