View source: R/modulationSpectrum_utilities.R
plotMS | R Documentation |
Plots a single modulation spectrum returned by
modulationSpectrum
. The result is the same as the plot produced
by modulationSpectrum
, but calling plotMS
is handy for
processed modulation spectra - for instance, for plotting the difference
between the modulation spectra of two sounds or groups of sounds.
plotMS(
ms,
X = NULL,
Y = NULL,
quantiles = c(0.5, 0.8, 0.9),
colorTheme = c("bw", "seewave", "heat.colors", "...")[1],
col = NULL,
logWarpX = NULL,
logWarpY = NULL,
main = NULL,
xlab = "Hz",
ylab = "1/kHz",
xlim = NULL,
ylim = NULL,
audio = NULL,
extraY = TRUE,
...
)
ms |
modulation spectrum - a matrix with temporal modulation in columns
and spectral modulation in rows, as returned by
|
X , Y |
rownames and colnames of |
quantiles |
labeled contour values, % (e.g., "50" marks regions that contain 50% of the sum total of the entire modulation spectrum) |
colorTheme |
black and white ('bw'), as in seewave package ('seewave'),
matlab-type palette ('matlab'), or any palette from
|
col |
actual colors, eg rev(rainbow(100)) - see ?hcl.colors for colors in base R (overrides colorTheme) |
logWarpX , logWarpY |
numeric vector of length 2: c(sigma, base) of pseudolog-warping the modulation spectrum, as in function pseudo_log_trans() from the "scales" package |
xlab , ylab , main , xlim , ylim |
graphical parameters |
audio |
(internal) a list of audio attributes |
extraY |
if TRUE, another Y-axis is plotted on the right showing 1000/Y |
... |
other graphical parameters passed on to |
ms1 = modulationSpectrum(runif(4000), samplingRate = 16000, plot = TRUE)
plotMS(ms1$processed) # identical to above
# compare two modulation spectra
ms2 = modulationSpectrum(soundgen(sylLen = 100, addSilence = 0),
samplingRate = 16000)
# ensure the two matrices have the same dimensions
ms2_resized = soundgen:::interpolMatrix(ms2$original,
nr = nrow(ms1$original), nc = ncol(ms1$original))
# plot the difference
plotMS(log(ms1$original / ms2_resized), quantile = NULL,
col = colorRampPalette(c('blue', 'yellow')) (50))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.