Learn R Programming

warbleR (version 1.1.9)

frange.detec: Detect frequency range on wave objects

Description

frange.detec detects the frequency range of acoustic signals in wave objects.

Usage

frange.detec(wave, wl = 512, fsmooth = 0.1, threshold = 10, wn = "hanning",
 flim = c(0, 22), bp = NULL, fast.spec = FALSE, ovlp = 50, pal = reverse.gray.colors.2, 
 widths = c(2, 1), main = NULL, plot = TRUE, all.detec = FALSE)

Arguments

wave

A 'wave' object produced by readWave or similar functions.

wl

A numeric vector of length 1 specifying the window length of the spectrogram, default is 512. This is used for calculating the frequency spectrum (using meanspec) and producing the spectrogram (using spectro, if plot = TRUE).

fsmooth

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.

threshold

Amplitude threshold (%) for fundamental frequency and dominant frequency detection. Default is 10.

wn

Character vector of length 1 specifying window name. Default is "hanning". See function ftwindow for more options. This is used for calculating the frequency spectrum (using meanspec) and producing the spectrogram (using spectro, if plot = TRUE).

flim

A numeric vector of length 2 for the frequency limit of the spectrogram (in kHz), as in spectro. Default is c(0, 22).

bp

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).

fast.spec

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.

ovlp

Numeric vector of length 1 specifying % of overlap between two consecutive windows, as in spectro. Default is 50. This is used for calculating the frequency spectrum (using meanspec) and producing the spectrogram (using spectro, if plot = TRUE).

pal

Color palette function for spectrogram. Default is reverse.gray.colors.2. See spectro for more palettes. Palettes as gray.2 may work better when fast.spec = TRUE.

widths

Numeric vector of length 2 to control the relative widths of the spectro (first element) and spectrum (second element).

main

Character vector of length 1 specifying the plot title. Default is NULL.

plot

Logical. Controls whether an image file is produced for each selection (in the working directory). Default is TRUE.

all.detec

Logical. If TRUE returns the start and end of all detected amplitude "hills". Otherwise only the range is returned. Default is FALSE.

Value

A data frame with 2 columns for low and high frequency values. A plot is produced (in the graphic device) if plot = TRUE (see details).

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 plot = TRUE a graph including a spectrogram and a frequency spectrum is produced in the graphic device. The graph would include gray areas in the frequency ranges exluded by the bandpass ('bp' argument), dotted lines highlighting the detected range.

See Also

frange, autodetec

Examples

Run this code
# NOT RUN {
{
data(tico)
frange.detec(wave = tico, wl = 512, fsmooth = 0.01, threshold = 1, bp = c(2, 8),
 widths = c(4, 2))

data(sheep)
frange.detec(wave = sheep, wl = 512, fsmooth = 0.2, threshold = 50, bp = c(0.3, 1), 
flim = c(0, 1.5), pal = reverse.heat.colors, main = "sheep")
}
# }

Run the code above in your browser using DataLab