frange
detect frequency range iteratively from signals in a selection table.
frange(X, wl = 512, it = "jpeg", line = TRUE, fsmooth = 0.1, threshold = 10,
wn = "hanning", flim = c(0, 22), bp = NULL, propwidth = FALSE, xl = 1, picsize = 1,
res = 100, fast.spec = FALSE, ovlp = 50, pal = reverse.gray.colors.2, parallel = 1,
widths = c(2, 1), main = NULL, img = TRUE, mar = 0.05, path = NULL, pb = TRUE)
A character vector of length 1 giving the image type to be used. Currently only "tiff" and "jpeg" are admitted. Default is "jpeg".
Logical argument to add red lines (or box if bottom.freq and top.freq columns are provided) at start and end times of selection. Default is TRUE
.
A numeric vector of length 1 to smooth the frequency spectrum with a mean sliding window in kHz. This help to average amplitude "hills" to minimize the effect of amplitude modulation. Default is 0.1.
Amplitude threshold (%) for fundamental frequency and dominant frequency detection. Default is 10.
A numeric vector of length 2 for the frequency limit of
the spectrogram (in kHz), as in spectro
. Default is c(0, 22).
A numeric vector of length 2 for the lower and upper limits of a frequency bandpass filter (in kHz) or "frange" to indicate that values in 'bottom.freq' and 'top.freq' columns will be used as bandpass limits. Default is c(0, 22).
Logical argument to scale the width of spectrogram
proportionally to duration of the selected call. Default is FALSE
.
Numeric vector of length 1. A constant by which to scale spectrogram width. Default is 1.
Numeric argument of length 1. Controls relative size of spectrogram. Default is 1.
Numeric argument of length 1. Controls image resolution. Default is 100 (faster) although 300 - 400 is recommended for publication/ presentation quality.
Logical. If TRUE
then image function is used internally to create spectrograms, which substantially
increases performance (much faster), although some options become unavailable, as collevels, and sc (amplitude scale).
This option is indicated for signals with high background noise levels. Palette colors gray.1
, gray.2
,
gray.3
, topo.1
and rainbow.1
(which should be imported from the package monitoR) seem
to work better with 'fast.spec' spectograms. Palette colors gray.1
, gray.2
,
gray.3
offer
decreasing darkness levels. THIS IS STILL BEING TESTED.
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing).
Numeric vector of length 2 to control the relative widths of the spectro (first element) and spectrum (second element).
Character vector of length 1 specifying the img title. Default is NULL
.
Logical. Controls whether a plot is produced. Default is TRUE
.
Numeric vector of length 1. Specifies the margins adjacent to the selections to set spectrogram limits. Default is 0.05.
Character string containing the directory path where the sound files are located.
If NULL
(default) then the current working directory is used.
Logical argument to control progress bar and messages. Default is TRUE
. Note that progress bar is only used
when parallel = 1.
The original data frame with an additional 2 columns for low and high frequency values. A plot is produced in the working directory if img = TRUE
(see details).
This functions aims to automatize the detection of frequency ranges. The frequency range is calculated as follows:
bottom.freq = the start frequency of the first amplitude "hill"
top.freq = the end frequency of the last amplitude "hill"
If img = TRUE
a graph including a spectrogram and a frequency spectrum is
produced for each selection (saved as an image file in the working directory). The graph would include gray areas in the frequency ranges exluded by the bandpass ('bp' argument), dotted lines highlighting the detected range.
# NOT RUN {
{
# First set temporary folder
setwd(tempdir())
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "selec.table"))
writeWave(Phae.long1,"Phae.long1.wav")
writeWave(Phae.long2,"Phae.long2.wav")
writeWave(Phae.long3,"Phae.long3.wav")
writeWave(Phae.long4,"Phae.long4.wav")
frange(X = selec.table, wl = 112, fsmooth = 1, threshold = 13, widths = c(4, 1),
img = TRUE, pb = TRUE, it = "tiff", line = TRUE, mar = 0.1, bp = c(1,10.5),
flim = c(0, 11))
}
# }
Run the code above in your browser using DataLab