Locating a signal

Locating a signal from the spectrogram is of primary importance in Luscinia, since all measurements rely on first deciding where within a spectrogram a signal might lie. We shall define a "region" of a spectrogram to be a set of contiguous time points in the spectrogram, with a maximum and minimum frequency defined for each one. A region of the spectrogram is chosen, for example, when a user highlights a pink blob in the spectrogram using the mouse.

Luscinia searches within a spectrogram region for a signal according to the following simple hysteresis loop algorithm:

1) Start at the first time point, and scan through the spectrogram points between the maximum and minimum frequency. Continue until a spectrogram point, p, is reached where the amplitude exceeds a threshold T1. p is then taken to be the first point in a new signal.
2) Examine the neighbouring 8 points in the spectrogram to p. If their amplitude exceeds a second threshold, T2, they are also included in the signal.
3) Repeat point 2 for each of the new points that were added in the last round of step 2, until no new points are added.
4) Continue through the rest of the unexplored spectrogram to see if any other signals were located within the highlighted region.

T2 is always less than or equal to T1. One way of making sense of the two thresholds is to say that T1 is a threshold to decide whether or not a signal is present, while T2 is a threshold to decide the extent of the signal. By default, Luscinia sets T1 = 0.2, and T2 =0.1, and the amplitudes are scaled relative to the maximum amplitude on the visible screen (from their original decibel scale) - 0 is the "white point" on the spectrogram, and 1 is the "black point" on the spectrogram. Another way to describe the theshold values is to say that, in the decibel scale, T1 [T2] is 0.8 [0.9] times the dynamic range below the maximum amplitude on the visible spectrogram.

If more than one signal has been located according to the above procedure, Luscinia then follows these segmentation rules:
1) If two signals overlap, they are merged
2) If two signals do not overlap, but that the time between the end of one signal and the beginning of the next is less than the "Minimum Gap" parameter, then they are merged. To mergetwo signals with a gap, Luscinia simply draws a straight line connecting the upper and lower limits of the two signals.