I have a dataset of phone recordings that I'd like to do some characteristic-level analysis on. The audio is sampled at 44khz stereo, with each channel containing the signal from one party in a conversation.

I would like to start by counting the number of time the call rings before the phone is picked up. I believe this to be simple, but am a little lost, so any pointers in the right direction would be much appreciated. I believe I need some sort of a matched filter, or maybe a bandwidth filter. The signal is generally clean -- I have attached a couple of graphs of the signal.

General solutions are appreciated, but I will be doing this in python so anything specific to that would be extra appreciated.

Additionally, if you have other ideas for extracting features using signal characteristics, I'm all ears (eyes).

plot of the signal

spectrogram of the same call

  • $\begingroup$ Step 1 would probably be to filter out only the two tones that are used in the ring sound; this will help isolate it from any background noise that might be present in the audio. This can be done with a pair of bandpass filters in cascade. $\endgroup$
    – Jason R
    Sep 12, 2015 at 17:03
  • $\begingroup$ Perhaps you can use a Goertzel filter (a simple 2nd-order IIR bandpass filter "tuned" to the frequency of one of your tones) to detect the beginning and end of each ring. Did you really have two rings close together in time, as you plots suggest? $\endgroup$ Sep 13, 2015 at 9:39

2 Answers 2


If you can identify one phone ring, then you can extract it and use it to construct a matched filter. The beginning of the wiki article is math heavy, but check out the example section. Additionally, Matlab has a page describing the matched filter from one of their toolboxes. You should really give it a try; it works like magic.

In the time domain, the matched filter is a cross-correlation of the signal against a known pattern (which is in this case a recording of the ringing). As a cross correlation it can efficiently be implemented using a DFT. The output of the matched filter is a time series.

The time series output will have a series of peaks whose locations correspond to the beginning of each ring. All you need to do is count the number of peaks which exceed some threshold.

If the rings could be different but you are guaranteed that they're selected from a finite set of rings (imagine different phone carriers or something) then you could use a bank of matched filters.


There are a lot of applicable solutions. The simplest one in my mind is 'template matching'. All you need for this solution are:

  1. Manually create one template / several templates. This requires you to segment a number of ringing signal. If you have multiple of them, you may take the average of these signals. Anyway, let us say this template signal is $T=[T_0,T_1,\cdots,T_K]$.
  2. For a given testing signal $S=[S_0,S_1,\cdots,S_N]$, you can compute $R=S\star T'$, which is the convolution between this signal and your template, and $T'=[T_K,\cdots,T_1,T_0]$ is the reversed version of $T$.
  3. Select a reasonable threshold to decide a segment of single is indeed `ringing', and finally apply non-maximum suppression.

Note, this is just one way of doing template matching w.r.t. the cross-correlation (see https://en.wikipedia.org/wiki/Cross-correlation). You can definitely use other criteria, e.g. normalized cross-correlation (see http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#matchtemplate).

A more complicated solution could be a 'ring' classifier, which assumes you have a number of 'ring' samples, and all of them are of the same length. Once you have these training samples, you can train a classifier (any kind, ranging from simple logistic regression to more complicated deep neuron network classifier). However, this solution may require a lot of labeled data.

Finally, a better solution could be 'hidden Markov model' and 'recurrent deep neuron network', which are too complicated to discussed in several lines. I say this is a better solution, because these are general models that can handle much more complicate scenario in speech recognition: in the context of speech recognition, 'ring' is nothing but a 'machine word', which is not fundamentally different a 'English word'.


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.