Extracts modulation spectra of all wav/mp3 files in a folder - separately for
each file, without averaging. Good for saving plots of the modulation spectra
and/or measuring the roughness of multiple files. See
modulationSpectrum
for further details.
modulationSpectrumFolder(
myfolder,
summaryFun = c("mean", "sd"),
htmlPlots = TRUE,
verbose = TRUE,
amRes = 5,
maxDur = 5,
logSpec = FALSE,
windowLength = 25,
step = NULL,
overlap = 80,
wn = "hamming",
zp = 0,
power = 1,
roughRange = c(30, 150),
plot = FALSE,
savePlots = FALSE,
logWarp = NA,
quantiles = c(0.5, 0.8, 0.9),
kernelSize = 5,
kernelSD = 0.5,
colorTheme = c("bw", "seewave", "...")[1],
xlab = "Hz",
ylab = "1/KHz",
width = 900,
height = 500,
units = "px",
res = NA,
...
)
full path to target folder
functions used to summarize each acoustic characteristic,
eg "c('mean', 'sd')"; user-defined functions are fine (see examples); NAs
are omitted automatically for mean/median/sd/min/max/range/sum, otherwise
take care of NAs yourself; if summaryFun = NULL
, analyze() returns a
list containing frame-by-frame values
if TRUE, saves an html file with clickable plots
if TRUE, reports progress and estimated time left
target resolution of amplitude modulation, Hz. If NULL
,
the entire sound is analyzed at once (or in chunks maxDur
s long),
resulting in a single roughness value. Otherwise, roughness is calculated
per frame, each selected to contain enough STFT windows to calculate
roughness with precision given by amRes
maximum allowed duration of a single sound, s (longer sounds are split, and their modulation spectra averaged)
if TRUE, the spectrogram is log-transformed prior to taking 2D FFT
length of FFT window, ms
you can override overlap
by specifying FFT step, ms
overlap between successive FFT frames, %
window type: gaussian, hanning, hamming, bartlett, rectangular, blackman, flattop
window length after zero padding, points
raise modulation spectrum to this power (eg power = 2 for ^2, or "power spectrum")
the range of temporal modulation frequencies that constitute the "roughness" zone, Hz
if TRUE, produces a spectrogram with pitch contour overlaid
if TRUE, saves plots as .png files
the base of log for warping the modulation spectrum (ie log2 if logWarp = 2); set to NULL or NA if you don't want to log-warp
labeled contour values, % (e.g., "50" marks regions that contain 50% of the sum total of the entire modulation spectrum)
the size of Gaussian kernel used for smoothing (1 = no smoothing)
the SD of Gaussian kernel used for smoothing, relative to its size
black and white ('bw'), as in seewave package ('seewave'),
or any palette from palette
such as 'heat.colors',
'cm.colors', etc
plotting parameters
plotting parameters
parameters passed to
png
if the plot is saved
parameters passed to
png
if the plot is saved
parameters passed to
png
if the plot is saved
parameters passed to
png
if the plot is saved
other graphical parameters passed to spectrogram
If summaryFun
is defined, returns a dataframe with just
roughness per audio file, otherwise returns a list with the actual
modulation spectra.
# NOT RUN {
ms = modulationSpectrumFolder('~/Downloads/temp', savePlots = TRUE,
kernelSize = 15)
ms
# }
Run the code above in your browser using DataLab