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, ...)
| X | object of class 'selection_table', 'extended_selection_table' or data frame containing columns for sound file name (sound.files),
selection number (selec), and start and end time of signal (start and end).
The output of |
|---|---|
| wl | A numeric vector of length 1 specifying the window length of the spectrogram, default is 512. |
| wl.freq | A numeric vector of length 1 specifying the window length of the spectrogram for measurements on the frequency spectrum. Default is 512. Higher values would provide more accurate measurements. |
| length.out | A numeric vector of length 1 giving the number of measurements of dominant frequency desired (the length of the time series). |
| wn | Character vector of length 1 specifying window name. Default is
"hanning". See function |
| ovlp | Numeric vector of length 1 specifying % of overlap between two
consecutive windows, as in |
| bp | 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. |
| threshold | 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. |
| threshold.time | amplitude threshold (%) for the time domain. Use for dominant frequency detection. If |
| threshold.freq | amplitude threshold (%) for the frequency domain. Use for frequency range detection from the spectrum (see 'frange.detec'). If |
| img | Logical argument. If |
| parallel | Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing). |
| path | Character string containing the directory path where the sound files are located. |
| img.suffix | A character vector of length 1 with a sufix (label) to add at the end of the names of image files. |
| pb | Logical argument to control progress bar. Default is |
| clip.edges | 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
|
| leglab | A character vector of length 1 or 2 containing the label(s) of the frequency contour legend in the output image. |
| frange.detec | Logical. Controls whether frequency range of signal is automatically
detected using the |
| fsmooth | A numeric vector of length 1 to smooth the frequency spectrum with a mean
sliding window (in kHz) used for frequency range detection (when |
| raw.contour | Logical. If |
| track.harm | Logical. If true warbleR's |
| adjust.wl | Logical. If |
| ... | Additional arguments to be passed to |
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 beginning 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()
{ #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()) }#> sound.files selec dfreq-1 dfreq-2 dfreq-3 dfreq-4 dfreq-5 dfreq-6 dfreq-7 #> 1 Phae.long1.wav 1 7.162 7.312 7.312 7.468 6.702 5.267 5.443 #> 2 Phae.long1.wav 2 6.938 7.183 7.279 7.437 7.537 7.566 6.089 #> 3 Phae.long1.wav 3 7.013 6.281 6.658 4.923 6.384 7.688 8.008 #> 4 Phae.long2.wav 1 6.638 4.763 4.912 5.513 5.588 5.588 6.487 #> 5 Phae.long2.wav 2 4.688 4.905 5.052 5.130 5.202 5.709 5.812 #> 6 Phae.long3.wav 1 6.713 6.713 4.912 5.138 6.263 6.562 6.412 #> 7 Phae.long3.wav 2 6.487 6.638 5.062 5.138 5.737 6.562 6.338 #> 8 Phae.long3.wav 3 6.487 4.838 5.062 5.438 5.362 6.112 5.888 #> 9 Phae.long4.wav 1 7.912 5.373 5.458 5.544 5.712 5.864 5.950 #> 10 Phae.long4.wav 2 8.062 7.866 5.528 5.634 5.831 6.040 6.252 #> 11 Phae.long4.wav 3 7.912 7.724 5.453 5.536 5.681 5.851 5.934 #> dfreq-8 dfreq-9 dfreq-10 dfreq-11 dfreq-12 dfreq-13 dfreq-14 dfreq-15 #> 1 5.513 5.569 8.117 6.638 6.519 6.498 6.490 6.102 #> 2 5.427 6.087 8.360 6.446 6.640 6.643 6.487 6.423 #> 3 6.343 8.073 8.487 6.997 6.562 6.562 6.493 6.319 #> 4 6.263 6.338 6.412 6.562 5.662 5.662 7.388 7.388 #> 5 5.983 6.092 6.112 6.162 6.467 6.769 6.780 6.713 #> 6 6.338 6.412 6.638 6.638 6.713 6.713 6.638 6.713 #> 7 6.263 6.412 6.562 6.338 5.963 6.112 6.188 6.862 #> 8 5.888 5.888 5.888 6.713 6.188 7.612 6.188 6.713 #> 9 6.252 6.736 6.992 7.219 7.390 7.561 7.791 8.187 #> 10 6.555 6.948 7.152 7.395 7.623 7.760 8.065 8.414 #> 11 6.288 6.599 6.917 7.095 7.323 7.460 7.765 7.946 #> dfreq-16 dfreq-17 dfreq-18 dfreq-19 dfreq-20 dfreq-21 dfreq-22 dfreq-23 #> 1 5.957 5.174 4.750 4.871 6.930 6.795 6.899 7.056 #> 2 6.177 6.112 5.544 5.360 4.393 5.567 6.969 6.868 #> 3 6.112 5.417 4.936 4.129 6.981 6.819 6.787 6.989 #> 4 6.787 7.013 7.537 7.388 7.388 5.513 6.338 6.412 #> 5 7.147 7.612 7.240 6.684 6.663 6.782 6.958 7.013 #> 6 6.487 6.638 6.862 6.412 6.412 6.638 6.713 6.713 #> 7 6.713 6.713 6.638 6.938 6.638 6.638 7.537 6.638 #> 8 6.338 6.412 6.787 6.412 6.487 6.713 6.713 6.638 #> 9 8.024 4.602 5.241 5.546 5.802 6.001 6.172 6.281 #> 10 8.787 6.431 5.365 5.631 5.952 6.048 6.200 6.428 #> 11 5.919 4.631 4.951 5.246 5.577 5.753 5.988 6.237 #> dfreq-24 dfreq-25 dfreq-26 dfreq-27 dfreq-28 dfreq-29 dfreq-30 #> 1 7.157 7.217 7.069 6.868 7.186 7.237 7.237 #> 2 6.963 7.106 7.230 7.237 7.237 7.183 7.237 #> 3 7.088 7.312 7.312 7.312 7.144 7.134 7.162 #> 4 7.537 7.237 7.237 6.638 7.838 5.963 6.037 #> 5 6.919 6.562 6.552 6.596 7.475 6.638 6.638 #> 6 7.162 7.013 7.013 7.013 6.938 7.088 7.763 #> 7 6.638 6.638 6.638 6.638 6.938 6.938 6.638 #> 8 6.638 6.713 6.638 6.713 6.938 7.013 6.638 #> 9 6.813 6.984 6.718 5.559 4.411 3.969 3.562 #> 10 6.919 7.049 6.648 5.200 4.331 3.969 3.712 #> 11 6.648 6.860 7.113 5.738 4.884 4.165 3.938