This afternoon I put together a quick MATLAB script to automate this process and ran it over the whole Youtube video audio.
The algorithm is as follows:
- Read acoustic data from file in 1s segments
- For each 1s segment use a Hilbert Transform (using FFT) to calculate the envelope of the waveform
- Calculate noise by smoothing the envelope with a window of length 0.1s (or 10x expected pulse width)
|Envelope (red); Smoothed (black)|
- Calculate SNR as the envelope amplitude divided by the noise
- Locate rising edges in the SNR that exceed the detection threshold (ie start of pulse)
|SNR (green) with detected pulse (x)|
- At end of processing plot detection times of arrival module ping interval (1.106s from previous analysis)
|Time of Arrival Ping Graph|
Interestingly I had not noticed the 2 individual segments previously, but upon a second listen a distinct discontinuity can be heard hence the 'realignment' of the ping times of arrival. This plot shows that the first segment corresponds to a time where the TPL was going away from the source as the times of arrival are increasing. The second segment has the TPL coming closer to the source near CPA due to the decrease and stabilisation of time of arrival.