Learn R Programming

warbleR (version 1.0.1)

trackfreqs: Spectrograms with frequency measurements

Description

trackfreqs creates spectrograms to visualize dominant and fundametal frequency measurements.

Usage

trackfreqs(X, wl = 512, flim = c(0, 22), wn = "hanning", pal =
  reverse.gray.colors.2, ovlp = 70, inner.mar = c(5, 4, 4, 2) + 0.1, outer.mar =
  c(0, 0, 0, 0), picsize = 1, res = 100, cexlab = 1, title = TRUE, trel =
  FALSE, propwidth = FALSE, xl = 1, osci = FALSE, gr = FALSE, sc = FALSE,
  fmax = 12, bp = c(0, 22), cex = c(0.8, 1), threshold = 10, col =
  c("dodgerblue", "chartreuse3"), pch = c(16, 17),  mar = 0.05, lpos =
  "topright", it = "jpeg")

Arguments

X
Data frame output from manualoc().
wl
A number specifying the spectrogram window length, default is 512.
flim
A numeric vector of length two for the frequency limit in kHz of the spectrogram, as in spectro. Default is c(0, 22).
wn
Character vector of length one specifying window name. Default is "hanning", as in spectro.
pal
Color palette function for spectrogram. Default is reverse.gray.colors.2.
ovlp
Numeric vector of length one specifyingconsecutive windows, as in spectro. Default is 70.
inner.mar
Numeric vector with 4 elements, default is c(5,4,4,2)+0.1. Specifies number of lines in inner plot margins where axis labels fall, with form c(bottom, left, top, right). See par.
outer.mar
Numeric vector with 4 elements, default is c(0,0,0,0). Specifies number of lines in outer plot margins beyond axis labels, with form c(bottom, left, top, right). See par.
picsize
Numeric argument of length one, controls relative size of spectrogram. Default is 1.
res
Numeric argument of length one, controls resolution of tiff image. Default is 100 (faster) although 300 - 400 is recommended for publication/ presentation quality.
cexlab
Numeric vector of length one, specifies relative size of axis labels. See spectro.
title
Logical argument to add a title to individual spectrograms. Default is TRUE.
trel
Logical argument to add a time axis scale relative to the wave. Default is FALSE.
propwidth
Logical argument to scale the width of spectrogram proportionally to duration of the selected call. Default is FALSE.
xl
Numeric vector of length one, a constant by which to scale spectrogram width if propwidth = TRUE. Default is 1.
osci
Logical argument to add an oscillogram underneath spectrogram, as in spectro. Default is FALSE.
gr
Logical argument to add grid to spectrogram. Default is FALSE.
sc
Logical argument to add amplitude scale to spectrogram, default is FALSE.
fmax
Numeric vector of length one, specifying the maximum for frequency measurements. Default is 12 Hz.
bp
A numeric vector of length two for the lower and upper limits of a frequency bandpass filter (in kHz). Default is c(0, 22).
cex
Numeric vector of length one, specifies relative size of points plotted for frequency measurements and legend font/points, respectively. See spectro.
threshold
% amplitude threshold for fundamental frequency and dominant frequency detection
col
Vector of length two specifying colors of points plotted to mark fundamental and dominant frequency measurements. Default is c("dodgerblue", "chartreuse3").
pch
Numeric vector of length two specifying plotting characters for the frequency measurements. Default is c(16, 17).
mar
Numeric vector of length one. Specifies the margins to subtract from/add to start and end points of manualoc() selection, respectively, dealineating spectrogram limits. Default is 0.05.
lpos
Character vector of length one or numeric vector of length two, specifiying position of legend. If the former, any keyword accepted by xy.coords can be used. If the latter, the first value will be the x coordinate and the second value the y coordinate for
it
A character vector of length one giving the image type to be used. Currently only "tiff" and "jpeg" are admitted. Default is "jpeg".

Value

  • Spectrograms per individual call marked with dominant and fundamental frequencies.

Details

This function provides visualization of two frequency measurements made by specan. Arguments that are accepted by xy.coords and can be used for lpos are: "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". Setting inner.mar to c(4,4.5,2,1) and outer.mar to c(4,2,2,1) works well when picsize = 2 or 3. Title font size, inner.mar and outer.mar (from mar and oma) don't work well when osci or sc = TRUE, this may take some optimization by the user.

See Also

specreator for creating spectrograms after manualoc, snrspecs for creating spectrograms to optimize noise margins used in sig2noise

Other spectrogram.creators: snrspecs; specreator

Examples

Run this code
data(list = c("Arre.aura", "Phae.cuvi"))
data(manualoc.df)
writeWave(Arre.aura, "Arre.aura.wav") #save sound files
writeWave(Phae.cuvi, "Phae.cuvi.wav")

# make Arre.aura and Phae.cuvi spectrograms

trackfreqs(manualoc.df, flim = c(0, 14), inner.mar = c(4,4.5,2,1), outer.mar = c(4,2,2,1),
picsize = 2, res = 300, cexlab = 2, fmax = 14, bp = c(0, 14), cex = c(1.5, 2),
col = c("blue", "red"),  mar = 0.09, lpos = "bottomright", it = "jpeg")

# make only Arre.aura spectrograms

trackfreqs(manualoc.df[grepl(c("Arre"), manualoc.df$sound.files), ], flim = c(3, 14),
inner.mar = c(4,4.5,2,1), outer.mar = c(4,2,2,1), picsize = 2, res = 300, cexlab = 2,
fmax = 14, bp = c(3, 14), cex = c(1.5, 2), col = c("blue", "red"),  mar = 0.09,
lpos = "bottomright", it = "tiff")

Run the code above in your browser using DataLab