View source: R/tweak_spectro.R
tweak_spectro | R Documentation |
tweak_spectro
plots a mosaic of spectrograms with varying display parameters to
facilitate selection of display parameters
tweak_spectro(
X,
length.out = 5,
ovlp = 90,
wl = c(100, 1000),
wn = "hanning",
collev.min = -40,
pal = "reverse.gray.colors.2",
path = NULL,
rm.axes = TRUE,
...
)
X |
object of class 'selection_table', 'extended_selection_table' or data frame with a single row and columns for sound file name (sound.files), selection number (selec),
and start and end time of signal (start and end). Default is |
length.out |
Numeric vector of length 1 controlling the number of sublevels of the numeric arguments for which a range has been provided. Ranges are allowed for 'ovlp', 'wl', and 'collev.min' arguments. |
ovlp |
Numeric vector of length 1 or 2 specifying % of overlap (or
lower/upper values the desired range) between two consecutive windows, as in
|
wl |
A numeric vector of length 1 or 2 specifying the window length (length 1) or the lower and upper range limits of the desired window length range (length 2) for creating spectrograms. Default is c(100, 1000). |
wn |
Character vector specifying the window function names to be used. Several
names can be provided. See |
collev.min |
A (negative) numeric vector of length 1 or 2. Determines the first argument
to use in 'collevels' for the internal spectrogram creating function. This replaces the
first element in the 'collevels' as in |
pal |
Color palette function for spectrogram. Default is "reverse.gray.colors.2".
Several palettes can be provided in a character vector. Note that, contrary to
other |
path |
Character string containing the directory path where the sound file are located. |
rm.axes |
Logical. If |
... |
Additional arguments to be passed to |
This functions aims to simplify the selection of spectrogram parameters. The function plots, for a single selection, a mosaic of spectrograms with varying display parameters. For numeric arguments the upper and lower limits of a range can be provided. The following arguments accept can have varying values:
wl
: Windows length (numeric range)
ovlp
: Overlap (numeric range)
collev.min
: Minimum value of the color levels (numeric range)
wn
: window function names (character)
pal
: palette (character)
Outputs are similar to those of catalog
. The output image files can be put together in a single pdf file with catalog2pdf
.
We recommend using low resolution (~60-100) and smaller dimensions (width & height < 10) if
aiming to generate pdfs (otherwise pdfs could be pretty big).
Image files with spectrograms of entire sound files in the working directory. Multiple pages can be returned, depending on the length of each sound file.
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
catalog2pdf
## Not run:
# Save to temporary working directory
# save sound file examples
data(list = c("Phae.long1", "lbh_selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
# variable collevels
tweak_spectro(X = lbh_selec_table, wl = 164, ovlp = c(90), wn = c("flattop"),
length.out = 16, nrow = 4, ncol = 4, width = 20, height = 11.3, rm.axes = TRUE,
cex = 1, box = F, collev.min = c(-20, -150), path = tempdir(), flim = c(0, 10))
# variable overlap and wn
tweak_spectro(X = lbh_selec_table, wl = 164, ovlp = c(50, 90),
wn = c("hanning", "hamming", "rectangle", "bartlett", "blackman", "flattop"),
length.out = 7, nrow = 6, ncol = 7, width = 20, height = 11.3, rm.axes = TRUE,
cex = 1, box = F, path = tempdir(), flim = c(0, 10))
# variable wl and wn
tweak_spectro(X = lbh_selec_table, wl = c(100, 1000), ovlp = c(50, 90), wn = "all",
length.out = 5, nrow = 10, ncol = 14, width = 20, height = 11.3, rm.axes = TRUE,
cex = 0.7, path = tempdir(), flim = c(0, 10))
# variable wl, collev.min and wn
tweak_spectro(X = lbh_selec_table, wl = c(100, 1000), ovlp = 90,
wn = c("hanning", "hamming", "rectangle"), collev.min = c(-110, -25),
length.out = 3, nrow = 10, ncol = 14, width = 20, height = 11.3, rm.axes = TRUE,
cex = 0.7, path = tempdir(), flim = c(0, 10))
# variable wl, wn and pal
tweak_spectro(X = lbh_selec_table, wl = c(100, 1000), ovlp = 90,
wn = c("hanning", "hamming", "rectangle"),
pal = c("reverse.gray.colors.2", "reverse.topo.colors",
"reverse.terrain.colors", "reverse.cm.colors"),
length.out = 4, nrow = 5, ncol = 10, width = 20, height = 11.3,
rm.axes = TRUE, cex = 0.7, lab.mar = 2, path = tempdir(), flim = c(0, 10))
# wl, wn and pal
tweak_spectro(X = lbh_selec_table, wl = c(100, 1000), ovlp = 90,
wn = c("hanning", "hamming", "rectangle"),
pal = c("reverse.gray.colors.2", "reverse.topo.colors",
"reverse.terrain.colors", "reverse.cm.colors"),
length.out = 4, nrow = 5, ncol = 10, width = 20, height = 11.3, rm.axes = TRUE,
cex = 0.7, group.tag = "wn", spec.mar = 0.4, lab.mar = 0.8, box = FALSE,
tag.pal = list(reverse.cm.colors), path = tempdir(), flim = c(0, 10))
check this floder
tempdir()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.