Learn R Programming

warbleR (version 1.1.2)

specan: Measure acoustic parameters in batches of sound files

Description

specan measures 22 acoustic parameters on acoustic signals for which the start and end times are provided.

Usage

specan(X, bp = c(0,22), wl = 512, threshold = 15, parallel = 1, fast = TRUE, path = NULL)

Arguments

X
Data frame with the following columns: 1) "sound.files": name of the .wav files, 2) "sel": number of the selections, 3) "start": start time of selections, 4) "end": end time of selections. The ouptut of manualoc or autodetec can be used as the input data frame.
bp
Numeric vector of length 2 giving the lower and upper limits of the frequency bandpass filter (in kHz). Default is c(0, 22).
wl
A numeric vector of length 1 specifying the spectrogram window length. Default is 512.
threshold
amplitude threshold (%) for fundamental frequency and dominant frequency detection. Default is 15.
parallel
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing). For windows OS the parallelsugar package should be installed.
fast
Logical. If TRUE (default) then the peakf acoustic parameter (see below) is not computed, which substantially increases performance (~9 times faster).
path
Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

Value

Data frame with the following acoustic parameters:
  • duration: length of signal
  • meanfreq: mean frequency (in kHz)
  • sd: standard deviation of frequency
  • median: median frequency (in kHz)
  • Q25: first quantile (in kHz)
  • Q75: third quantile (in kHz)
  • IQR: interquantile range (in kHz)
  • skew: skewness (see note in specprop description)
  • kurt: kurtosis (see note in specprop description)
  • sp.ent: spectral entropy
  • sfm: spectral flatness
  • mode: mode frequency
  • centroid: frequency centroid (see specprop)
  • peakf: peak frequency (frequency with highest energy)
  • meanfun: average of fundamental frequency measured across acoustic signal
  • minfun: minimum fundamental frequency measured across acoustic signal
  • maxfun: maximum fundamental frequency measured across acoustic signal
  • meandom: average of dominant frequency measured across acoustic signal
  • mindom: minimum of dominant frequency measured across acoustic signal
  • maxdom: maximum of dominant frequency measured across acoustic signal
  • dfrange: range of dominant frequency measured across acoustic signal
  • modindx: modulation index. Calculated as the accumulated absolute difference between adjacent measurements of fundamental frequencies divided by the frequency range

Details

The ouptut of manualoc or autodetec can be used directly without any additional modification. The function measures 22 acoustic parameters on each selection in the data frame. Most parameters are produced internally by specprop, fpeaks, fund, and dfreq from the package seewave.

Examples

Run this code
## Not run: 
# # First set temporary folder
# setwd(tempdir())
# 
# data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "manualoc.df"))
# writeWave(Phae.long1,"Phae.long1.wav")
# writeWave(Phae.long2,"Phae.long2.wav")
# writeWave(Phae.long3,"Phae.long3.wav")
# writeWave(Phae.long4,"Phae.long4.wav")
# 
# a <- specan(X = manualoc.df, bp = c(0, 22))
# 
# # using a diferent threshold
# a <- specan(X = manualoc.df, bp = c(0, 22), threshold = 20)
# # View(a)
# 
# ## End(Not run)

Run the code above in your browser using DataLab