Internal soundgen function.
.audSpectrogram(
audio,
step = 1,
dynamicRange = 80,
filterType = c("butterworth", "chebyshev", "gammatone")[1],
nFilters = 128,
nFilters_oct = NULL,
filterOrder = if (filterType == "gammatone") 4 else 3,
bandwidth = NULL,
bandwidthMult = 1,
minFreq = 20,
maxFreq = audio$samplingRate/2,
minBandwidth = 10,
output = c("audSpec", "audSpec_processed", "filterbank", "filterbank_env", "roughness"),
plot = TRUE,
plotFilters = FALSE,
osc = c("none", "linear", "dB")[2],
heights = c(3, 1),
ylim = NULL,
yScale = "bark",
contrast = 0.2,
brightness = 0,
maxPoints = c(1e+05, 5e+05),
padWithSilence = TRUE,
colorTheme = c("bw", "seewave", "heat.colors", "...")[1],
col = NULL,
extraContour = NULL,
xlab = NULL,
ylab = NULL,
xaxp = NULL,
mar = c(5.1, 4.1, 4.1, 2),
main = NULL,
grid = NULL,
width = 900,
height = 500,
units = "px",
res = NA,
...
)
a list returned by readAudio
step, ms (determines time resolution of the plot, but not of the returned envelopes per channel). step = NULL means no downsampling at all (ncol of output = length of input audio)
dynamic range, dB. All values more than one dynamicRange under maximum are treated as zero
"butterworth" = Butterworth filter
butter
, "chebyshev" = Chebyshev filter
butter
, "gammatone" =
gammatone
the number of filters between minFreq
and
maxFreq
(determines frequency resolution, while yScale
determines the location of center frequencies)
an alternative way to specify frequency resolution: the number of filters per octave
filter order (defaults to 4 for gammatones, 3 otherwise)
filter bandwidth, octaves. If NULL, defaults to ERB
bandwidths as in gammatone
a scaling factor for all bandwidths (1 = no effect)
the range of frequencies to analyze. If the spectrogram looks empty, try increasing minFreq - the lowest filters are prone to returning very large values
minimum filter bandwidth, Hz (otherwise filters may become too narrow when nFilters is high; has no effect if filterType = 'gammatone')
a list of 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
should a spectrogram be plotted? TRUE / FALSE
if TRUE, plots the filters as central frequencies ± bandwidth/2
"none" = no oscillogram; "linear" = on the original scale; "dB" = in decibels
a vector of length two specifying the relative height of the spectrogram and the oscillogram (including time axes labels)
frequency range to plot, kHz (defaults to 0 to Nyquist frequency). NB: still in kHz, even if yScale = bark, mel, or ERB
determines the location of center frequencies of the filters
a number, recommended range -1 to +1. The spectrogram is
raised to the power of exp(3 * contrast)
. Contrast >0 increases
sharpness, <0 decreases sharpness
how much to "lighten" the image (>0 = lighter, <0 = darker)
the maximum number of "pixels" in the oscillogram (if any) and spectrogram; good for quickly plotting long audio files; defaults to c(1e5, 5e5)
if TRUE, pads the sound with just enough silence to resolve the edges properly (only the original region is plotted, so the apparent duration doesn't change)
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
actual colors, eg rev(rainbow(100)) - see ?hcl.colors for colors in base R (overrides colorTheme)
a vector of arbitrary length scaled in Hz (regardless of yScale!) that will be plotted over the spectrogram (eg pitch contour); can also be a list with extra graphical parameters such as lwd, col, etc. (see examples)
graphical parameters for plotting
if numeric, adds n = grid
dotted lines per kHz
graphical parameters for saving plots passed to
png
other graphical parameters