3
$\begingroup$

I am hoping to find a linux program or library for a language like perl or python (open to any solution though) to detect low frequency cues in an audio recording.

Ideally I would end up with a printout of timestamps in HH:MM:SS format that correspond to where the cues occur.

Here is visual example of the audio cue:

enter image description here

The cue appears to be unique waveform and there is no other sounds at this frequency through out the recording. The frequency is so low that it is in audible. Based on this I assume it must be possible to detect the cues.

$\endgroup$
4
  • $\begingroup$ what you want is a fourier transform library that allows you to output the frequency, then all you do is scan through for that frequency occurring. I'd suggest googling for either fourier transform, or frequency identification $\endgroup$
    – Rory Alsop
    Commented Mar 31, 2017 at 16:13
  • $\begingroup$ @audionuma do you know how id initiate a migration? $\endgroup$
    – BryanK
    Commented Mar 31, 2017 at 17:20
  • $\begingroup$ flagging might raise a moderator's attention. I wil do it now. $\endgroup$
    – audionuma
    Commented Mar 31, 2017 at 20:45
  • 1
    $\begingroup$ libsndfile and fftw will do the trick. $\endgroup$
    – Mark
    Commented Apr 1, 2017 at 11:49

1 Answer 1

1
$\begingroup$

You can solve this problem with a simple time based low pass filter, no need for an FFT:

  • Calculate the minimum integration time you want by dividing your sampling rate by the frequency you want to detect. For a 10Hz at 44100Hz, it would be 4410 samples, so let's take 4500 samples.

  • Then apply a low pass filter to this group of samples (choosing the right frequency cut), you will isolate the frequencies you want. I do not really know how to use them, but it should look something like this:

$$y(n) = x{(n)}+x(n-1) + ...$$

  • Calculate the relative power of your filtrated group of samples in dBFS (Full Scale) based on this formula:

$$p_{RMS} = \sqrt{\frac{ x_1^2 + x_2^2 + \ldots}n } $$ $$dbFS = 20\log_{10}\frac{ p_{RMS}}{p_{max}}$$ 'n' behind the number of samples and 'pmax' the maximum value of a sample.

If the level you get is superior to a specific threshold of your choice (not to low, because your audio certainly have a tiny low frequency component), then there is a cue, otherwise there isn't.

As for the timestamp aspect, you can increase a variable each time you get into this low frequency detection loop, and calculate the time passed using the sampling rate. Then write an array containing the input/output time of each successful detection.

Not sure if the minimum integration time is really necessary though.

$\endgroup$
2
  • $\begingroup$ I did end up using a lowpass filter so I will accept this answer. My final solution was slightly different though. After applying a lowpass I used ffmpeg to do a silence detection. Every timestamp where there was a silence end or start was my cue. I would like to ask if you know of good sources for learning the math you posted - its way over my head. I will post my solution soon, maybe you will have some ideas for improvements. $\endgroup$
    – BryanK
    Commented Apr 4, 2017 at 10:57
  • $\begingroup$ The website dsprelated.com is pretty useful to me, it contains a freebook section with serious information, while staying accessible to the beginners (which I still am). The EBU R128 Loudness Recommendation should be interesting to look at. There probably is an expensive academic book about it. And getting in touch with audio developers (working on DAWs like Ardour, Reaper, Audacity ...) could also be a good idea. $\endgroup$
    – user27675
    Commented Apr 4, 2017 at 15:57

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.