spcc_align {baRulho}R Documentation

Align start and end of signal using spectrographic cross-correlation


spcc_align aligns start and end of signal in an extended selection table using spectrographic cross-correlation


spcc_align(X, parallel = 1, pb = TRUE, hop.size = 11.6, wl = NULL, ovlp = 90, 
wn = 'hanning')



object of class 'extended_selection_table' created by the function selection_table from the warbleR package. The object must include the following additional columns: 'signal.type', 'bottom.freq' and 'top.freq'.


Numeric vector of length 1. Controls whether parallel computing is applied by specifying the number of cores to be used. Default is 1 (i.e. no parallel computing).


Logical argument to control if progress bar is shown. Default is TRUE.


A numeric vector of length 1 specifying the time window duration (in ms). Default is 11.6 ms, which is equivalent to 512 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied.


A numeric vector of length 1 specifying the window length of the spectrogram, default is NULL. If supplied, 'hop.size' is ignored.


Numeric vector of length 1 specifying % of overlap between two consecutive windows, as in spectro. Default is 90. High values of ovlp slow down the function but produce more accurate results.


A character vector of length 1 specifying the window name as in ftwindow.


This function uses spectrographic cross-correlation to align the position in time of signals with regard to a reference signal. The signal recorded at the closest distance to the source is used as reference. Precise alignment is crucial for downstream measures of signal degradation. The function calls warbleR's xcorr and find_peaks internally to align signals using cross-correlation. The output extended selection table contains the new start and end values after alignment.


Extended selection table similar to input data in which time parameters (columns 'start' and 'end') have been tailored to more closely match the start and end of the reference signal.


Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)


Araya-Salas, M. (2020). baRulho: baRulho: quantifying habitat-induced degradation of (animal) acoustic signals in R. R package version 1.0.2

Clark, C.W., Marler, P. & Beeman K. (1987). Quantitative analysis of animal vocal phonology: an application to Swamp Sparrow song. Ethology. 76:101-115.

See Also

blur_ratio, xcorr


# load example data

# method 1
spcc_align(X = playback_est_unaligned)

[Package baRulho version 1.0.5 Index]