Avisoft logo

SASLab Manual


Main window : Analyze > Specials > Scan for template spectrogram patterns


This classification tool allows identifying certain spectrogram patterns by using a spectrogram cross-correlation algorithm.



The entire sound file is continuously compared with a user-defined set of template spectrograms. The comparison is done by computing a two-dimensional spectrogram cross-correlation function (CCF). A subsequent peak search on the resulting CCF trace provides the time stamps of the occurrence of the template patterns within the sound file. The name of the template spectrogram that provides the maximum correlation coefficient (the highest degree of similarity) within a user-defined time interval (masking interval) is considered as the class membership of the unknown event.

The template spectrograms that have previously been saved from the spectrogram window command File > Save Spectrogram (ASCII/Binary)... as .son files can be selected from the Select button or simply by drag-and-drop. The launched File Open dialog allows to select several files at once (by using the or keys). All template spectrograms must reside in the same folder. The templates must have been created with uniform spectrogram parameters (same FFT length, frame size, overlap and sample rate). Also, the sample rate of the sound file to be examined must correspond to the sample rate at which the template spectrograms have been created.

In order to reject low-frequency noise that might otherwise disturb the correlation procedure, a high-pass cutoff frequency can be specified. All spectrogram components below that frequency will be ignored. Accordingly, the low-pass cutoff frequency setting will exclude any signal components above the specified frequency.

For tolerating slight frequency deviations between the templates and the unknown sounds, a max frequency deviation can be specified. Depending on the frequency resolution of the template spectrograms and the specified maximum deviation, the cross-correlation will be repeated for various frequency shifts. The maximum correlation coefficient is finally taken as the similarity score. The cross-correlation algorithm is similar to that of the Avisoft-CORRELATOR application (see the online help or the manual of that application of details).

The identification threshold controls the peak search on the CCF traces. This threshold is applied directly to the cross-correlation coefficients. Sound events that provide CCF coefficients below that threshold will be ignored. Once a peak exceeds the threshold, it will be taken as a potential sound event of the associated class. If you have selected more than one template spectrogram, the algorithm also searches for peaks on the other template channels that occur shortly before and after the original peak. If there are higher peaks on the other template channels within the masking interval, the sound event will be assigned to the class that provides the highest peak.

Slight deviations between the template spectrograms and the sound event to be recognized might prevent the proper recognition of its class memberships. Adding more templates that cover as much variations as possible can compensate for this problem (at the expense of computing time). In order to get unified class names for all variations, the filenames of the spectrogram templates (.son) that should belong to the same class must start with identical names. The unified class names must be separated from the rest of the filename by either a dot (.) or an underscore (_). The following set of templates would define two classes only (e1 and e2). e1_v1 and e1_v2 represent variations that refer to the same class.

e1_v1.son
e1_v2.son
e2_v1.son
e2_v2.con

If the option Mark detected events by labels is activated, the results of the classification procedure will be stored into labels that are displayed on the waveform and spectrogram displays. The option Create section labels (instead of single-point labels) will generate section labels instead of the standard single point labels. The durations of these sections will be determined by the durations of the associated template spectrograms. The margin parameter will additionally dilate the section labels by the specified time interval.

The desired section label layer to which the labels should be assigned can be selected from this list box.

The option Filter Classification Results allows to pick out a single class out of the classified sound events (by ignoring all events that have been assigned to other classes). The take class list box selects the desired class. The option replace label texts with index will assign an incrementing index to the filtered events.

The Default button will set all parameters to their default settings.

The classification procedure is initiated by clicking at the Start button. A new classification report window will appear.


Avisoft Bioacoustics last modified on 10 September 2019