In an audio recording (say a telephone conv. b/w two people), how would I programatically detect and remove the dial-tone at the beginning of a call using python. Ex : sample audio call As you can see the first 15 seconds or so is just a dial tone like tring-tring-tring-tring.

Are there any audio analysis libraries in python that could help me achieve this?

If this is not the right forum, kindly point me to the right place.

  • 1
    $\begingroup$ unless your country's telephones work extremely different then my country's ones, then "tring" is not a dial tone, but a ring tone? Also, what about simply detecting the crossing of an amplitude threshold? This looks extremely much like "amplitude higher than 0.7 for more than a millisecond" is a reliable detector. $\endgroup$ – Marcus Müller Nov 17 '17 at 8:09
  • $\begingroup$ Ok thank you for correcting me. ringtone/hold music/ivrs was what I meant. the tring tring part. could you please point me to any python libraries please. thank you. $\endgroup$ – kRazzy R Nov 17 '17 at 19:41
  • $\begingroup$ . OK, updating my question. But you got it right, I just want to `detect parts of the call which has automated IVRS, or hold music or the tring tring $\endgroup$ – kRazzy R Nov 17 '17 at 20:24
  • $\begingroup$ @MarcusMüller Could you pleae tell me how to go about "amplitude higher than 0.7 for more than a millisecond detection method $\endgroup$ – kRazzy R Dec 5 '17 at 19:08
  • $\begingroup$ I'm afraid I don't know where to start if you don't know what "amplitude" means in the context of a digital signal. $\endgroup$ – Marcus Müller Dec 5 '17 at 19:42

You can use librosa and scikit-learn to create a machine learning classifier. It would work roughly like this:


  1. Get training signals of (A) just phone ringing, and (B) no phone ringing, e.g. ordinary conversation.
  2. Segment the training signals with a frame size of ~50-500 milliseconds.
  3. Extract features from each frame, e.g. MFCCs.
  4. Train a scikit-learn classifier, e.g.

    classifier.fit(X, y)

    where X is a ndarray of feature vectors, and y are the target labels, e.g. "ring" (1) and "no ring" (0).



where X is an ndarray of feature vectors extracted in the same way from a test signal.

The latest frame which returns a positive "ring" label is where to truncate the signal.

  • $\begingroup$ by Segment the training signals with a frame size of ~50-500 milliseconds do you mean splitting the whole audio into pieces of 50milliseconds each? Or do you mean for it to be the sliding window frame size. $\endgroup$ – kRazzy R Dec 5 '17 at 22:54
  • $\begingroup$ Do you have example for such sets to train and observe the results? $\endgroup$ – Mark Apr 19 at 6:52

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.