dfts
extracts the dominant frequency values as a time series.
of signals selected by manualoc
or autodetec
.
dfts(X, wl = 512, wl.freq = 512, length.out = 20, wn = "hanning", ovlp = 70,
bp = c(0, 22), threshold = 0, threshold.time = NULL, threshold.freq = NULL,
img = TRUE, parallel = 1, path = NULL, img.suffix = "dfts", pb = TRUE,
clip.edges = FALSE, leglab = "dfts", frange.detec = FALSE, fsmooth = 0.1,
raw.contour = FALSE, track.harm = FALSE, adjust.wl = TRUE, ...)
A numeric vector of length 1 specifying the window length of the spectrogram, default is 512.
A numeric vector of length 1 specifying the window length of the spectrogram for measurements on the frecuency spectrum. Default is 512. Higher values would provide more accurate measurements.
A numeric vector of length 1 giving the number of measurements of dominant frequency desired (the length of the time series).
Character vector of length 1 specifying window name. Default is
"hanning". See function ftwindow
for more options.
Numeric vector of length 1 specifying % of overlap between two
consecutive windows, as in spectro
. Default is 70.
A numeric vector of length 2 for the lower and upper limits of a frequency bandpass filter (in kHz). Default is c(0, 22). If 'frange' then the 'bottom.freq' and 'top.freq' columns are used bandpass limits.
amplitude threshold (%) for dominant frequency detection. Default is 0. Note that amplitude threshold for time and frequency domains can be defined independently. See "threshold.time" and "threshold.freq" arguments.
amplitude threshold (%) for the time domain. Use for dominant frequency detection. If NULL
(default) then the 'threshold' value is used.
amplitude threshold (%) for the frequency domain. Use for frequency range detection from the spectrum (see 'frange.detec'). If NULL
(default) then the
'threshold' value is used.
Logical argument. If FALSE
, image files are not produced. Default is TRUE
.
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing).
Character string containing the directory path where the sound files are located.
A character vector of length 1 with a sufix (label) to add at the end of the names of image files.
Logical argument to control progress bar. Default is TRUE
.
Logical argument to control whether edges (start or end of signal) in
which amplitude values above the threshold were not detected will be removed. If
TRUE
this edges will be excluded and signal contour will be calculated on the
remainging values. Default is FALSE
.
A character vector of length 1 or 2 containing the label(s) of the frequency contour legend in the output image.
Logical. Controls whether frequency range of signal is automatically
detected using the frange.detec
function. If so, the range is used as the
bandpass filter (overwriting 'bp' argument). Default is FALSE
.
A numeric vector of length 1 to smooth the frequency spectrum with a mean
sliding window (in kHz) used for frequency range detection (when frange.detec = TRUE
). This help to average amplitude "hills" to minimize the effect of
amplitude modulation. Default is 0.1.
Logical. If TRUE
then a list with the original contours
(i.e. without interpolating values to make all contours of equal length) is returned (and no images are produced).
Logical. If true warbleR's track_harm
function is
used to track frequency contours. Otherwise seewave's dfreq
is used by default.
Logical. If TRUE
'wl' (window length) is reset to be lower than the
number of samples in a selection if the number of samples is less than 'wl'. Default is TRUE
.
Additional arguments to be passed to trackfreqs
.
The function returns a data frame with the dominant frequency values measured across the signals. If raw.contour = TRUE
a list with the raw frequency detections (i.e. without interpolating values to make all contours of equal length) is returned. If img is
TRUE
it also produces image files with the spectrograms of the signals listed in the
input data frame showing the location of the dominant frequencies
(see trackfreqs
description for more details).
This function extracts the dominant frequency values as a time series.
The function uses the approx
function to interpolate values between dominant frequency
measures. If there are no frequencies above the amplitude threshold at the begining or end
of the signals then NAs will be generated. On the other hand, if there are no frequencies
above the amplitude threshold in time windows in between the signal in which amplitude was
detected then the values of the adjacent will be interpolated
to fill out the missing values (e.g. no NAs in between detected amplitude segments).
Araya-Salas, M., & Smith-Vidaurre, G. (2017). warbleR: An R package to streamline analysis of animal acoustic signals. Methods in Ecology and Evolution, 8(2), 184-191.
sig2noise
, trackfreqs
, sp.en.ts
, ffts
, ffDTW
, dfDTW
Other spectrogram creators: color.spectro
,
dfDTW
, ffDTW
,
ffts
, multi_DTW
,
phylo_spectro
, snrspecs
,
sp.en.ts
, specreator
,
trackfreqs
# NOT RUN {
{
#load data
data(list = c("Phae.long1", "Phae.long2","lbh_selec_table"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav")) #save sound files
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
# run function
dfts(X = lbh_selec_table, length.out = 30, flim = c(1, 12), bp = c(2, 9), wl = 300, pb = FALSE,
path = tempdir())
# note a NA in the row 4 column 3 (dfreq-1)
# this can be removed by clipping edges (removing NAs at the start and/or end
# when no freq was detected)
dfts(X = lbh_selec_table, length.out = 30, flim = c(1, 12), bp = c(2, 9), wl = 300, pb = FALSE,
clip.edges = TRUE,
path = tempdir())
}
# }
Run the code above in your browser using DataLab