2
$\begingroup$

I'm a Software Engineer Undergraduate. I'm trying to detect drum strokes(beats) in real-time in python. I used amplitude threshold-based onset detect (beat detect) algorithm but it takes other noises also onsets and it omits some actual beats with low amplitude. Can you have suggestions to optimize my code or another way to solve this?

$\endgroup$

2 Answers 2

3
$\begingroup$

My guess is that the currently popular and new and likely robust way to solve this detection problem is to feed a sequence of audio fingerprints (such as MFCCs) to an RNN machine learning algorithm that was trained on a large wide range of rhythm tracks mixed with increasing levels of realistic background noise.

Feeding audio stream samples directly to a deeper CNN+RNN ML inference engine might work even better by detecting humanly resolvable beat details that audio fingerprinting misses, but that would be computationally far less efficient and would take a lot longer to train.

$\endgroup$
2
  • $\begingroup$ And way more energy $\endgroup$ Nov 3, 2019 at 18:14
  • $\begingroup$ Is there any possibility to find an existing Neural Network machine learning model that has already been trained with a large dataset? Is MFCC enough to classify a sound from another or we should use other audio fingerprints too depending on the situation or we should use other features like Spectral Bandwidth, Spectral Centroid, Zero Crossing rate, etc? $\endgroup$
    – Asiri Amal
    Nov 3, 2019 at 21:34
0
$\begingroup$

Using an adaptive threshold might help you: calculating the mean amplitude over a small moving time window (e.g. 0.5 sec), and setting a threshold as a function of the mean (e.g. 3X). This should detect sudden changes in amplitude (which drum strokes almost always are).

$\endgroup$
1
  • $\begingroup$ I already use a threshold-based onset detect algorithm with a window size of 0.02s. But when I put lower value to the threshold it takes noises as a strokes and when I set it as a higher value it passes real strokes. I put that much of window size to get real-time output less than 0.1s, which cannot identify the difference between input and output time gap to the human ear. $\endgroup$
    – Asiri Amal
    Nov 3, 2019 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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