Summary: This module describes how a matched filter algorithm is used to identify birdcall audio files.
Matched filters do an excellent job of identifying sound samples, so we decided to apply the method here to identify birdcall audio files. A matched filter searches for a sample clip, the filter, within a longer audio recording. Convolution compares the filter to the longer signal at each possible offset. The greater the maximum amplitude of the convolution result, the stronger the match. By having a different filter for each birdcall, we can search an audio file to identify which birdcall it contains.
The matched filter algorithm is as follows:
![]() |
Our first step in implementing the matched filter algorithm was to create a library of birdcall filters. To do this, we looked at the spectrograms of a few sample audio files of the same birdcall and selected a portion that looked representative of the call.
![]() |
For each birdcall, one of the representative audio segments was saved as a filter. Because the first two steps of the above matched filter algorithm affect only the filter library and are independent of the input signal, we reversed the filters and normalized their energy before saving them to wave files.
The following MATLAB script performed our matched filter algorithm. When given a wave file as input, it would tell us how well the audio sample matched against each of the 6 birdcall filters.
function result = birdcheck(file)
[sig, fs, nbits] = wavread(file);
signal=sig(:,1);
signal=signal/max(abs(signal));
filters{1}=wavread('filters/bob.wav');
filters{2}=wavread('filters/lt.wav');
filters{3}=wavread('filters/lw.wav');
filters{4}=wavread('filters/pygmy.wav');
filters{5}=wavread('filters/red.wav');
filters{6}=wavread('filters/redcry.wav');
for i=1:6
filter=filters{i};
result(i) = max(abs(cconv(signal,filter(end:-1:1))));
end
end
The script was able to correctly identify several birdcalls. It did fail to correctly identify four cases in two categories: