segmentFolder: Segment all files in a folder

Description Usage Arguments Details Value Examples

Description

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

Usage

1
2
3
4
5
segmentFolder(myfolder, 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, savePath = NA, verbose = TRUE, reportEvery = 10, ...)

Arguments

myfolder

full path to target folder

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

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

...

other graphical parameters passed to plot

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# download 260 sounds from Anikin & Persson (2017)
# http://cogsci.se/personal/results/
# 01_anikin-persson_2016_naturalistics-non-linguistic-vocalizations/260sounds_wav.zip
# unzip them into a folder, say '~/Downloads/temp'
myfolder = '~/Downloads/temp'  # 260 .wav files live here
s = segmentFolder(myfolder, verbose = 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')

## End(Not run)

tatters/soundgen_beta documentation built on May 14, 2019, 9 a.m.