I would like to write a Python program that takes an audio file as input, recognizes clapping sounds in it, then extracts these sounds into a file.

My idea is the following:

  1. Get (or create) a dataset containing many audio clips with clapping sounds in them,
  2. Train a machine learning model to recognize these sounds,
  3. Test the model on new audio files.

How can I achieve point 2? I already have a dataset ready, so I just need to run a ML algorithm on them. I've seen several alternatives:

  1. Keras
  2. PyTorch
  3. Scikit-learn

But I have no idea which to choose for this particular task and how I would go about writing a Python script that does the training and testing. Can someone please help?


1 Answer 1


Claps have specific waves that could be detected with several solutions, including ML.

Here is a code using keras:


In addition to that, there is an eating sound project that is quite similar and there is probably useful code like this one with wav2vec:


On the other hand, non-ML could have even better results, as they follow simple rules that detect claps efficiently. For instance:




  • $\begingroup$ Thanks bro, 'preciate it $\endgroup$
    – Klangen
    Dec 21, 2022 at 12:06
  • $\begingroup$ You're welcome :) $\endgroup$ Dec 21, 2022 at 20:48

Your Answer

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

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