Learn R Programming

wrassp (version 1.0.5)

rfcana: rfcana

Description

rfcana function adapted from libassp

Usage

rfcana(
  listOfFiles = NULL,
  optLogFilePath = NULL,
  beginTime = 0,
  centerTime = FALSE,
  endTime = 0,
  windowShift = 5,
  windowSize = 20,
  effectiveLength = TRUE,
  window = "BLACKMAN",
  order = 0,
  preemphasis = -0.95,
  lpType = "RFC",
  toFile = TRUE,
  explicitExt = NULL,
  outputDirectory = NULL,
  forceToLog = useWrasspLogger,
  verbose = TRUE
)

Value

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

Arguments

listOfFiles

vector of file paths to be processed by function

optLogFilePath

path to option log file

beginTime

= <time>: set begin of analysis interval to <time> seconds (default = 0: begin of file)

centerTime

set single-frame analysis with the analysis window centred at <time> seconds; overrules beginTime, endTime and windowShift options

endTime

= <time>: set end of analysis interval to <time> seconds (default = 0: end of file)

windowShift

= <dur>: set analysis window shift to <dur> ms (default: 5.0)

windowSize

= <dur>: set analysis window size to <dur> ms; overrules effectiveLength option

effectiveLength

make window size effective rather than exact

window

= <type>: set analysis window function to <type> (default: BLACKMAN)

order

= <num>: set prediction order to <num> (default: sample rate in kHz + 3)

preemphasis

= <val>: set pre-emphasis factor to <val> (default: -0.95)

lpType

= <type>: calculate <type> LP parameters; <type> may be: "ARF": area function "LAR": log area ratios "LPC": linear prediction filter coefficients "RFC": reflection coefficients (default)

toFile

write results to file (default extension dependent on LpType .arf/.lar/.lpc/.rfc)

explicitExt

set if you wish to override 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.

verbose

display infos & show progress bar

Author

Raphael Winkelmann

Lasse Bombien

Details

Linear Prediction analysis of <listOfFiles> using the autocorrelation method and the Durbin recursion. This program calculates the RMS amplitudes of the input and residual signal in dB and, per default, reflection coefficients (see '-t' option). Analysis results will be written to a file with the base name of the input file and the parameter type in lower case as extension (e.g. '.rfc'). Default output is in SSFF binary format (tracks 'rms', 'gain' and the LP type in lower case).

Examples

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

# perform linear prediction analysis
res <- rfcana(path2wav, toFile=FALSE)

# plot reflection coefficients
matplot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + 
          attr(res, 'startTime'), 
        res$rfc, 
        type='l', 
        xlab='time (s)', 
        ylab='reflection coefficient values')
        

Run the code above in your browser using DataLab