soundgen (version 1.5.0)

segmentFolder: Segment all files in a folder

Description

Finds syllables and bursts in all .wav files in a folder.

Usage

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"),
  ...)

Arguments

myfolder

full path to target folder

htmlPlots

if TRUE, saves an html file with clickable plots

shortestSyl

minimum acceptable length of syllables, ms

shortestPause

minimum acceptable break between syllables, ms. Syllables separated by less time are merged. To avoid merging, specify shortestPause = NA

sylThres

amplitude threshold for syllable detection (as a proportion of global mean amplitude of smoothed envelope)

interburst

minimum time between two consecutive bursts (ms). If specified, it overrides interburstMult

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

burstThres

to qualify as a burst, a local maximum has to be at least burstThres times the height of the global maximum of amplitude envelope

peakToTrough

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)

troughLeft

should local maxima be compared to the trough on the left and/or right of it? Default to TRUE and FALSE, respectively

troughRight

should local maxima be compared to the trough on the left and/or right of it? Default to TRUE and FALSE, respectively

windowLength

length (ms) and overlap ( window used to produce the amplitude envelope, see env

overlap

length (ms) and overlap ( window used to produce the amplitude envelope, see env

summary

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, ...)

plot

if TRUE, produces a segmentation plot

savePlots

if TRUE, saves plots as .png files

savePath

full path to the folder in which to save the plots. Defaults to NA

verbose, reportEvery

if TRUE, reports progress every reportEvery files and estimated time left

col

main plotting parameters

xlab

main plotting parameters

ylab

main plotting parameters

main

main plotting parameters

width

parameters passed to png if the plot is saved

height

parameters passed to png if the plot is saved

units

parameters passed to png if the plot is saved

res

parameters passed to png if the plot is saved

sylPlot

a list of graphical parameters for displaying the syllables

burstPlot

a list of graphical parameters for displaying the bursts

...

other graphical parameters passed to plot

Value

If summary is TRUE, returns a dataframe with one row per audio file. If summary is FALSE, returns a list of detailed descriptives.

Details

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.

Examples

Run this code
# 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, savePlot = 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