- x
path to a folder, one or more wav or mp3 files c('file1.wav',
'file2.mp3'), Wave object, numeric vector, or a list of Wave objects or
numeric vectors
- samplingRate
sampling rate of x (only needed if x is a
numeric vector)
- scale
maximum possible amplitude of input, used to normalize the input
vector (only needed if x is a numeric vector)
- from, to
if NULL (default), analyzes the whole sound, otherwise
from...to (s)
- step
step, ms (determines time resolution of the plot, but not of the
returned envelopes per channel). step = NULL means no downsampling at all
when envelope = "hil" (ncol of output = length of input audio) and a
default of 5 ms when envelope = "rms"
- dynamicRange
regions under -dynamicRange dB are treated as silent
- filterType
"butterworth" = Butterworth filter (IIR)
butter, "chebyshev" = Chebyshev filter (IIR)
cheby1, "gammatone" = gammatone filter (FIR)
- envelope
the method of computing the envelope of each channel: "rms" =
root mean square per window, which is faster but gives limited time
resolution (default), "hil" = analytic envelope obtained with a Hilbert
transform, low-pass filtered and downsampled unless step = NULL,
which is slower but gives the best possible time resolution. As a simple
heuristic, you may want to use "hil" if your desired time step is smaller
than ~5 ms
- nFilters_oct
the approximate number of filters per octave between
minFreq and maxFreq; the actual resolution depends on
yScale: for instance, if yScale = 'ERB', center frequencies
are equally spaced on the ERB scale (set plotFilters = TRUE to check)
- nFilters
an alternative way to specify frequency resolution: if
specified, overrides nFilters_oct
- yScale
determines the location of center frequencies of the filters
- filterOrder
filter order (defaults to 4 for gammatones, 3 otherwise)
- bandwidth
filter bandwidth, octaves; if NULL, defaults to ERB
bandwidths
- bandwidthMult
a scaling factor for all bandwidths (1 = no effect)
- minFreq, maxFreq
the range of frequencies to analyze. If the
spectrogram looks empty, try increasing minFreq - the lowest filters are
prone to returning very large values, which can make the rest of the
spectrogram look empty
- minBandwidth
minimum filter bandwidth, Hz (otherwise filters may
become too narrow when nFilters is high); only affects Butterworth and
Chebyshev filters, not gammatones
- output
character vector specifying which measures to return.
Defaults to everything, but this takes a lot of RAM, so shorten to
what's needed if analyzing many files at once
- reportEvery
when processing multiple inputs, report estimated time
left every reportEvery iterations (NULL = default, NA = don't
report); see reportTime
- cores
number of cores for parallel processing
- plot
if TRUE, produces a plot of the results
- savePlots
if TRUE, creates a subdirectory in the input directory (if
input is a file or folder) or in the working directory (if input is a
vector etc), named after the function (eg "spectrogram/"). All plots and
audio files (if any) are saved in this new directory. If there are multiple
inputs, an html notebook is also created for easy viewing and listening
- embed
if TRUE and savePlots is set and there are multiple inputs, all
saved images and audio (if any) are embedded in the exported html notebook
for easy sharing; if FALSE, the html file links to separate images and audio
files (but separate files are still saved). NB: for this to work, package
"base64enc" must be installed
- plotFilters
if TRUE, plots the filters as central frequencies ±
bandwidth/2
- osc
"none" = no oscillogram; "linear" = on the original scale; "dB" =
in decibels
- heights
a vector of length two specifying the relative height of the
spectrogram and the oscillogram (including time axes labels)
- ylim
frequency range to plot, kHz (defaults to 0 to Nyquist
frequency). NB: still in kHz, even if yScale = bark, mel, or ERB
- contrast
controls the sharpness or contrast of the image: <0 =
decrease contrast, 0 = no change, >0 increase contrast. Recommended range
approximately (-1, 1). The spectrogram is raised to the power of
exp(3 * contrast)
- brightness
makes the image lighter or darker, range [-1, 1] (default 0
= no change); for colorTheme = "bw", <0 = darker, >0 = lighter, range [-1,
1]. Values are remapped through a smooth sigmoid transfer curve that
preserves the full color palette. To lighten or darken the palette itself,
change the colors
- maxPoints
the maximum number of "pixels" in the oscillogram (if any)
and spectrogram; good for quickly plotting long audio files; defaults to
c(1e5, 5e5); does not affect reassigned spectrograms
- colorTheme
black and white ('bw'), as in seewave package ('seewave'),
matlab-type palette ('matlab'), or any palette from
palette such as 'heat.colors', 'cm.colors', etc
- col
actual colors, eg rev(rainbow(100)) - see ?hcl.colors for colors
in base R (overrides colorTheme)
- extraContour
a vector of arbitrary length scaled in Hz (regardless of
yScale, but nonlinear yScale also warps the contour) that will be plotted
over the spectrogram (eg pitch contour); can also be a list with extra
graphical parameters such as lwd, col, warp (FALSE = plot as is,
TRUE = warp to conform to nonlinear yScale), etc. (see examples)
- xlab, ylab, main, mar, xaxp
graphical parameters for plotting
- grid
if numeric, adds n = grid dotted lines per kHz and the
same number of lines along the time axis
- width, height, units, res
graphical parameters for saving plots passed to
png
- ...
other graphical parameters