Learn R Programming

wrassp (version 0.1.2)

forest: forest

Description

forest function adapted from libassp

Usage

forest(listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0,
  endTime = 0, windowShift = 5, windowSize = 20, effectiveLength = TRUE,
  nominalF1 = 500, gender = "m", estimate = FALSE, order = 0,
  incrOrder = 0, numFormants = 4, window = "BLACKMAN",
  preemphasis = -0.8, toFile = TRUE, explicitExt = NULL,
  outputDirectory = NULL, forceToLog = useWrasspLogger)

Arguments

listOfFiles
vector of file paths to be processed by function
optLogFilePath
path to option log file
beginTime
=
endTime
=
windowShift
= : set analysis window shift to ms (default: 5.0)
windowSize
= : set analysis window size to ms (default: 30.0)
effectiveLength
make window size effective rather than exact
nominalF1
= : set nominal F1 frequency to Hz (default: 500.0 Hz)
gender
= : set gender specific parameters where = f[emale], m[ale] or u[nknown] (when =f: eff. window length = 12.5 ms nominal F1 = 560.0 Hz)
estimate
insert rough frequency estimates of missing formants (default: frequency set to zero)
order
decrease default order by 2 (one resonance less)
incrOrder
increase default order by 2 (one resonance more)
numFormants
= : set number of formants to (default: 4; maximum: 8 or half the LP order)
window
= : set analysis window function to (default: BLACKMAN)
preemphasis
= : set pre-emphasis factor to (-1
toFile
write results to file (default extension is .fms)
explicitExt
set if you wish to overwride the default extension
outputDirectory
directory in which output files are stored. Defaults to NULL, i.e. the directory of the input files
forceToLog
is set by the global package variable useWrasspLogger. This is set to FALSE by default and should be set to TRUE is logging is desired.

Value

  • nrOfProcessedFiles or if only one file to process return AsspDataObj of that file

Details

Formant estimation of the signal(s) in . Raw resonance frequency and bandwidth values are obtained by root-solving of the Linear Prediction polynomial from the autocorrelation method and the Split-Levinson-Algorithm (SLA). Resonances are then classified as formants using the so-called Pisarenko frequencies (by-product of the SLA) and a formant frequeny range table derived from the nominal F1 frequency. The latter may have to be increased by about 12% for female voices (see NominalF1 and Gender options). Formant estimates will be written to a file with the base name of the input file and extension '.fms'. Default output is in SSFF binary format (tracks 'fm' and 'bw')

Examples

Run this code
# get path to audio file
path2wav <- list.files(system.file("extdata", package = "wrassp"),
                       pattern = glob2rx("*.wav"),
                       full.names = TRUE)[1]

# calculate formant values
res <- forest(path2wav, toFile=FALSE)

# plot formant values
matplot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) +
          attr(res, 'startTime'),
        res$fm,
        type='l',
        xlab='time (s)',
        ylab='Formant frequency (Hz)')

Run the code above in your browser using DataLab