Finds syllables and bursts in all .wav files in a folder.
segmentFolder(
myfolder,
htmlPlots = TRUE,
shortestSyl = 40,
shortestPause = 40,
sylThres = 0.9,
interburst = NULL,
interburstMult = 1,
burstThres = 0.075,
peakToTrough = 3,
troughLeft = TRUE,
troughRight = FALSE,
windowLength = 40,
overlap = 80,
summary = TRUE,
plot = FALSE,
savePlots = FALSE,
savePath = NA,
verbose = TRUE,
reportEvery = 10,
col = "green",
xlab = "Time, ms",
ylab = "Amplitude",
main = NULL,
width = 900,
height = 500,
units = "px",
res = NA,
sylPlot = list(lty = 1, lwd = 2, col = "blue"),
burstPlot = list(pch = 8, cex = 3, col = "red"),
...
)
full path to target folder
if TRUE, saves an html file with clickable plots
minimum acceptable length of syllables, ms
minimum acceptable break between syllables, ms.
Syllables separated by less time are merged. To avoid merging, specify
shortestPause = NA
amplitude threshold for syllable detection (as a proportion of global mean amplitude of smoothed envelope)
minimum time between two consecutive bursts (ms). If
specified, it overrides interburstMult
multiplier of the default minimum interburst
interval (median syllable length or, if no syllables are detected, the same
number as shortestSyl
). Only used if interburst
is
not specified. Larger values improve detection of unusually broad shallow
peaks, while smaller values improve the detection of sharp narrow peaks
to qualify as a burst, a local maximum has to be at least
burstThres
times the height of the global maximum of amplitude
envelope
to qualify as a burst, a local maximum has to be at
least peakToTrough
times the local minimum on the LEFT over
analysis window (which is controlled by interburst
or
interburstMult
)
should local maxima be compared to the trough on the left and/or right of it? Default to TRUE and FALSE, respectively
should local maxima be compared to the trough on the left and/or right of it? Default to TRUE and FALSE, respectively
length (ms) and overlap (
window used to produce the amplitude envelope, see
env
length (ms) and overlap (
window used to produce the amplitude envelope, see
env
if TRUE, returns only a summary of the number and spacing of syllables and vocal bursts. If FALSE, returns a list containing full stats on each syllable and bursts (location, duration, amplitude, ...)
if TRUE, produces a segmentation plot
if TRUE, saves plots as .png files in the target folder
full path to the folder in which to save the plot. Defaults to NA
if TRUE, reports progress every reportEvery
files and estimated time left
main plotting parameters
main plotting parameters
main plotting parameters
main 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
a list of graphical parameters for displaying the syllables
a list of graphical parameters for displaying the bursts
other graphical parameters passed to plot
If summary
is TRUE, returns a dataframe with one row per audio
file. If summary
is FALSE, returns a list of detailed descriptives.
This is just a convenient wrapper for segment
intended for
analyzing the syllables and bursts in a large number of audio files at a
time. In verbose mode, it also reports ETA every ten iterations. With default
settings, running time should be about a second per minute of audio.
# NOT RUN {
# Download 260 sounds from the supplements to Anikin & Persson (2017) at
# http://cogsci.se/publications.html
# unzip them into a folder, say '~/Downloads/temp'
myfolder = '~/Downloads/temp' # 260 .wav files live here
s = segmentFolder(myfolder, verbose = TRUE, savePlots = TRUE)
# Check accuracy: import a manual count of syllables (our "key")
key = segmentManual # a vector of 260 integers
trial = as.numeric(s$nBursts)
cor(key, trial, use = 'pairwise.complete.obs')
boxplot(trial ~ as.integer(key), xlab='key')
abline(a=0, b=1, col='red')
# }
Run the code above in your browser using DataLab