0
$\begingroup$

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.

$\endgroup$
6
  • 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$ Nov 17, 2017 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, 2017 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, 2017 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, 2017 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$ Dec 5, 2017 at 19:42

1 Answer 1

3
$\begingroup$

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

Training

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

Prediction

classifier.predict(X)

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.

$\endgroup$
2
  • $\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, 2017 at 22:54
  • $\begingroup$ Do you have example for such sets to train and observe the results? $\endgroup$
    – Mark
    Apr 19, 2021 at 6:52

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.