ffts extracts the fundamental frequency values as a time series
of signals selected by manualoc or autodetec.
ffts(X, wl = 512, length.out = 20, wn = "hanning", ovlp = 70, bp = c(0, 22), threshold = 15, img = TRUE, parallel = 1, path = NULL, img.suffix = "ffts", pb = TRUE, clip.edges = FALSE, leglab = "ffts", ff.method = "seewave", ...)
| 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. |
| length.out | A numeric vector of length 1 giving the number of measurements of fundamental 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). |
| threshold | amplitude threshold (%) for fundamental frequency detection. Default is 15. |
| 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.
If |
| img.suffix | A character vector of length 1 with a suffix (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. |
| ff.method | Character. Selects the method used to calculate the fundamental
frequency. Either 'tuneR' (using |
| ... | Additional arguments to be passed to |
A data frame with the fundamental frequency values measured across the signals. 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 fundamental frequencies
(see trackfreqs description for more details).
This function extracts the fundamental frequency values as a time series.
The function uses the approx function to interpolate values between fundamental 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 theshold in between signal segments in which amplitude was
detected then the values of this adjacent segments will be interpolated
to fill out the missing values (e.g. no NAs in between detected amplitude segments).
sig2noise, trackfreqs, dfts, ffDTW, dfDTW
Other spectrogram creators:
color.spectro(),
dfDTW(),
dfts(),
ffDTW(),
multi_DTW(),
phylo_spectro(),
snrspecs(),
sp.en.ts(),
specreator(),
trackfreqs()
{ #load data data(list = c("Phae.long1", "Phae.long2","lbh_selec_table")) writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav")) #save sound files writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav")) #save sound files # run function ffts(lbh_selec_table, length.out = 50, flim = c(1, 12), bp = c(2, 9), wl = 300, path = tempdir()) }#> sound.files selec ffreq-1 ffreq-2 ffreq-3 ffreq-4 ffreq-5 ffreq-6 ffreq-7 #> 1 Phae.long1.wav 1 2.500 2.500 2.500 2.500 2.500 2.500 2.500 #> 2 Phae.long1.wav 2 2.500 2.500 2.500 2.500 2.500 2.500 2.500 #> 3 Phae.long1.wav 3 NA NA NA 2.500 2.500 2.500 2.500 #> 4 Phae.long2.wav 1 2.500 3.520 4.541 5.561 5.625 5.625 5.625 #> 5 Phae.long2.wav 2 2.500 2.500 2.500 2.500 2.500 2.500 2.500 #> 6 Phae.long3.wav 1 5.625 5.625 5.625 5.625 5.625 5.625 5.625 #> 7 Phae.long3.wav 2 2.500 3.457 4.413 5.370 5.625 5.625 5.625 #> 8 Phae.long3.wav 3 5.625 5.625 5.625 5.625 4.994 4.133 3.272 #> 9 Phae.long4.wav 1 NA NA NA 2.812 2.812 2.812 2.812 #> 10 Phae.long4.wav 2 2.812 2.812 2.812 2.812 2.812 2.812 2.845 #> 11 Phae.long4.wav 3 2.812 2.812 2.812 2.812 2.812 2.812 2.845 #> ffreq-8 ffreq-9 ffreq-10 ffreq-11 ffreq-12 ffreq-13 ffreq-14 ffreq-15 #> 1 2.500 2.500 2.513 2.653 2.793 4.630 6.735 6.276 #> 2 2.500 2.500 2.500 2.526 2.653 2.781 2.812 2.812 #> 3 2.500 2.500 2.500 2.500 2.500 2.621 2.761 4.152 #> 4 4.936 4.149 3.362 3.214 3.214 3.214 3.805 4.592 #> 5 2.545 2.640 2.736 2.837 2.960 3.083 3.206 3.903 #> 6 5.281 4.543 3.805 3.214 3.214 3.214 3.214 4.439 #> 7 5.281 4.543 3.805 3.214 3.214 3.214 3.214 4.439 #> 8 3.214 4.075 4.936 5.740 6.314 6.888 7.462 7.500 #> 9 2.812 2.812 2.862 3.001 3.140 3.214 3.214 3.214 #> 10 2.985 3.124 3.214 3.214 3.214 3.214 3.214 3.214 #> 11 2.985 3.124 3.214 3.214 3.214 3.214 3.214 3.214 #> ffreq-16 ffreq-17 ffreq-18 ffreq-19 ffreq-20 ffreq-21 ffreq-22 ffreq-23 #> 1 4.351 3.214 3.214 3.214 3.214 3.214 3.214 3.214 #> 2 3.386 5.300 7.213 6.013 4.264 3.214 3.214 3.214 #> 3 6.256 7.500 7.500 7.150 5.226 3.302 3.214 3.214 #> 4 5.379 5.835 6.142 6.448 6.754 7.060 7.366 7.500 #> 5 4.641 5.379 5.625 5.625 5.625 5.855 6.429 7.003 #> 6 5.751 7.063 7.500 7.500 7.500 7.500 7.500 7.500 #> 7 5.751 7.063 7.500 7.500 7.500 7.500 7.500 7.500 #> 8 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 9 3.324 3.509 3.695 3.750 3.750 3.750 3.750 3.750 #> 10 3.324 3.509 3.695 3.750 3.750 3.750 3.750 3.750 #> 11 3.324 3.509 3.695 3.750 3.750 3.750 3.750 3.750 #> ffreq-24 ffreq-25 ffreq-26 ffreq-27 ffreq-28 ffreq-29 ffreq-30 ffreq-31 #> 1 3.083 2.903 3.444 4.707 5.510 5.089 4.668 4.247 #> 2 3.214 3.214 3.132 2.968 2.870 4.018 5.166 5.395 #> 3 4.001 5.084 5.625 5.625 5.625 5.625 5.576 4.493 #> 4 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 5 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 6 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 7 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 8 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 9 3.750 3.750 3.750 3.765 4.026 4.286 4.397 3.811 #> 10 3.750 3.995 4.255 4.466 3.880 3.295 2.812 2.812 #> 11 3.750 3.750 3.750 3.765 4.026 4.286 4.397 3.811 #> ffreq-32 ffreq-33 ffreq-34 ffreq-35 ffreq-36 ffreq-37 ffreq-38 ffreq-39 #> 1 3.827 3.553 3.313 3.214 3.214 3.214 3.214 3.214 #> 2 5.013 4.630 4.247 3.865 3.750 3.750 3.750 3.750 #> 3 3.411 3.214 3.214 3.214 3.214 3.214 3.214 3.214 #> 4 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 5 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 6 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 7 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 8 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 9 3.226 2.812 2.812 2.812 2.870 3.009 3.149 3.214 #> 10 2.812 2.833 2.903 2.972 3.042 3.112 3.181 3.214 #> 11 3.226 2.812 2.812 2.812 2.870 3.009 3.149 3.214 #> ffreq-40 ffreq-41 ffreq-42 ffreq-43 ffreq-44 ffreq-45 ffreq-46 ffreq-47 #> 1 3.214 3.214 3.214 3.214 3.214 3.214 4.089 6.013 #> 2 3.750 3.575 3.356 3.291 3.509 3.728 3.750 3.750 #> 3 3.214 3.214 3.433 3.673 3.750 3.750 3.750 3.750 #> 4 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 5 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 6 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 7 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 8 7.500 7.500 7.500 7.500 7.500 7.500 7.500 7.500 #> 9 3.214 3.214 3.214 3.214 3.214 3.854 4.690 5.527 #> 10 3.214 3.214 3.214 3.214 3.214 3.854 4.690 5.527 #> 11 3.214 3.214 3.214 3.214 3.214 3.854 4.690 5.527 #> ffreq-48 ffreq-49 ffreq-50 #> 1 7.500 7.500 7.500 #> 2 3.750 3.750 3.750 #> 3 3.750 3.750 3.750 #> 4 7.500 7.500 7.500 #> 5 7.500 7.500 7.500 #> 6 7.500 7.500 7.500 #> 7 7.500 7.500 7.500 #> 8 7.500 7.500 7.500 #> 9 5.625 5.625 5.625 #> 10 5.625 5.625 5.625 #> 11 5.625 5.625 5.625