Title: | Interface to the 'ASSP' Library |
---|---|
Description: | A wrapper around Michel Scheffers's 'libassp' (<https://libassp.sourceforge.net/>). The 'libassp' (Advanced Speech Signal Processor) library aims at providing functionality for handling speech signal files in most common audio formats and for performing analyses common in phonetic science/speech science. This includes the calculation of formants, fundamental frequency, root mean square, auto correlation, a variety of spectral analyses, zero crossing rate, filtering etc. This wrapper provides R with a large subset of 'libassp's signal processing functions and provides them to the user in a (hopefully) user-friendly manner. |
Authors: | Raphael Winkelmann [aut],
Lasse Bombien [aut],
Michel Scheffers [aut],
Markus Jochim [cre, aut] |
Maintainer: | Markus Jochim <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.5 |
Built: | 2025-03-11 04:46:04 UTC |
Source: | https://github.com/ips-lmu/wrassp |
wrassp is a wrapper for R around Michel Scheffers's libassp (Advanced Speech Signal Processor). The libassp library aims at providing functionality for handling speech signal files in most common audio formats and for performing analyses common in phonetic science/speech science. This includes the calculation of formants, fundamental frequency, root mean square, auto correlation, a variety of spectral analyses, zero crossing rate, filtering etc. This wrapper provides R with a large subset of libassp's signal processing functions and provides them to the user in a (hopefully) user-friendly manner.
This package is part of the next iteration of the EMU Speech Database Management System which aims to be as close to an all-in-one solution for generating, manipulating, querying, analyzing and managing speech databases as possible. For an overview of the system please visit this URL: http://ips-lmu.github.io/EMU.html.
Available signal processing functions:
acfana
: Analysis of short-term autocorrelation function
afdiff
: Computes the first difference of the signal
affilter
: Filters the audio signal (see docs for types)
cepstrum
: Short-term cepstral analysis
cssSpectrum
: Cepstral smoothed version of dftSpectrum
dftSpectrum
: Short-term DFT spectral analysis
forest
: Formant estimation
ksvF0
: F0 analysis of the signal
lpsSpectrum
: Linear Predictive smoothed version of dftSpectrum
mhsF0
: Pitch analysis of the speech signal using Michel's (M)odified (H)armonic (S)ieve algorithm
rfcana
: Linear Prediction analysis
rmsana
: Analysis of short-term Root Mean Square amplitude
zcrana
: Analysis of the averages of the short-term positive and negative zero-crossing rates
Available file handling functions:
read.AsspDataObj
: read an existing SSFF file into a AsspDataObj
which is its in-memory equivalent.
write.AsspDataObj
: write a AsspDataObj
out to a SSFF file.
acfana function adapted from libassp
acfana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 20, effectiveLength = TRUE, window = "BLACKMAN", analysisOrder = 0, energyNormalization = FALSE, lengthNormalization = FALSE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
acfana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 20, effectiveLength = TRUE, window = "BLACKMAN", analysisOrder = 0, energyNormalization = FALSE, lengthNormalization = FALSE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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 = beginning of file) |
centerTime |
= <time>: 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 parameter |
effectiveLength |
make window size effective rather than exact |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
analysisOrder |
= <num>: set analysis order to <num> (default: 0 = sample rate in kHz + 3) |
energyNormalization |
calculate energy-normalized autocorrelation |
lengthNormalization |
calculate length-normalized autocorrelation |
toFile |
write results to file (default extension is .acf) |
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 |
Analysis of short-term autocorrelation function of the signals in <listOFFiles>. Analysis results will be written to a file with the base name of the input file and extension '.acf'. Default output is in SSFF binary format (track 'acf').
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate short-term autocorrelation res <- acfana(path2wav, toFile=FALSE) # plot short-term autocorrelation values matplot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$acf, type='l', xlab='time (s)', ylab='short-term autocorrelation values')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate short-term autocorrelation res <- acfana(path2wav, toFile=FALSE) # plot short-term autocorrelation values matplot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$acf, type='l', xlab='time (s)', ylab='short-term autocorrelation values')
Add a track to an AsspDataObj
addTrack(dobj, trackname, data, format = "INT16", deleteExisting = FALSE)
addTrack(dobj, trackname, data, format = "INT16", deleteExisting = FALSE)
dobj |
The data object to which the data is to be added |
trackname |
The name of the new track |
data |
a matrix with values |
format |
format for binary writing to file (defaults to 'INT16') |
deleteExisting |
Delete existing track with the same (default: FALSE) |
The specified data object is extended by a new track named trackname
.
If there already is a track with the same name and deleteExisiting
is FALSE
the function does nothing but returns with an error. If
deleteExisting
is TRUE
the existing track will be removed
(see delTrack
.
data
to be added is a numeric matrix (or will be coerced to one).
It must have
the same number of rows as the tracks that already exist in the object
(if any). TODO add format
information.
the object including the new track
Lasse Bombien
afdiff function adapted from libassp
afdiff( listOfFiles = NULL, optLogFilePath = NULL, computeBackwardDifference = FALSE, computeCentralDifference = FALSE, channel = 1, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
afdiff( listOfFiles = NULL, optLogFilePath = NULL, computeBackwardDifference = FALSE, computeCentralDifference = FALSE, channel = 1, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
listOfFiles |
vector of file paths to be processed by function |
optLogFilePath |
path to option log file |
computeBackwardDifference |
compute backward difference (s'[n] = s[n] - s[n-1]) (default: forward difference s'[n] = s[n+1] - s[n]) |
computeCentralDifference |
compute central/interpolated/3-point difference |
channel |
= <num>: for multi-channel input files: extract and differentiate channel <num> (1 <= <num> <= 8 default: channel 1) |
toFile |
write results to file (default extension is .d+(extensionsOfAudioFile)) |
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 |
Computes the first difference of the signal in the audio- formatted file(s) <listOfFiles>. The differentiated signal will be written to a file with the base name of the input file and an extension consisting of '.d', followed by the extension of the input file. The format of the output file will be the same as that of the input file. Differentiation can improve results on F0 analysis of e.g. EGG signals because it removes a DC offset, attenuates very low frequency components - and in the case of central differentiation also very high ones - and enhances the moment of glottal closure.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # compute the first forward difference of the signal res <- afdiff(path2wav, toFile=FALSE) # plot samples # (only plot every 10th element to accelerate plotting) plot(seq(0,numRecs.AsspDataObj(res) - 1, 10) / rate.AsspDataObj(res), res$audio[c(TRUE, rep(FALSE,9))], type='l', xlab='time (s)', ylab='Audio samples')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # compute the first forward difference of the signal res <- afdiff(path2wav, toFile=FALSE) # plot samples # (only plot every 10th element to accelerate plotting) plot(seq(0,numRecs.AsspDataObj(res) - 1, 10) / rate.AsspDataObj(res), res$audio[c(TRUE, rep(FALSE,9))], type='l', xlab='time (s)', ylab='Audio samples')
affilter function adapted from libassp
affilter( listOfFiles = NULL, optLogFilePath = NULL, highPass = 4000, lowPass = 0, stopBand = 96, transition = 250, useIIR = FALSE, numIIRsections = 4, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
affilter( listOfFiles = NULL, optLogFilePath = NULL, highPass = 4000, lowPass = 0, stopBand = 96, transition = 250, useIIR = FALSE, numIIRsections = 4, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
listOfFiles |
vector of file paths to be processed by function |
optLogFilePath |
path to option log file |
highPass |
= <num>: set the high-pass cut-off frequency to <num> Hz (default: 4000, high-pass filtering is applied) |
lowPass |
= <num>: set the low-pass cut-off frequency to <num> Hz (default: 0, no low-pass filtering) |
stopBand |
= <num>: set the stop-band attenuation to <num> dB (default: 93.0 dB, minimum: 21.0 dB) |
transition |
= <num>: set the width of the transition band to <num> Hz (default: 250.0 Hz) |
useIIR |
switch from the default FIR to IIR filter |
numIIRsections |
= <num>: set the number of 2nd order sections to <num> (default: 4) where each section adds 12dB/oct to the slope of the filter |
toFile |
write results to file (for default extension see details section)) |
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 |
Filters the audio signal in <listOfFiles>. By specifying the high-pass and/or low-pass cut-off frequency one of four filter characteristics may be selected as shown in the table below.
hp | lp | filter characteristic | extension |
> 0 | 0 | high-pass from hp | '.hpf' |
0 | > 0 | low-pass up to lp | '.lpf' |
> 0 | > hp | band-pass from hp to lp | '.bpf' |
> lp | > 0 | band-stop between lp and hp | '.bsf' |
Please note: per default a high-pass filter from 0 to 4000 Hz is applied.
The Kaiser-window design method is used to compute the coefficients of a linear-phase FIR filter with unity gain in the pass-band. The cut-off frequencies (-6 dB points) of the filters are in the middle of the transition band. The filtered signal will be written to a file with the base name of the input file and an extension corresponding to the filter characteristic (see table). The format of the output file will be the same as that of the input file.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # band-pass filter signal between 4000 and 5000 Hz res <- affilter(path2wav, highPass=4000, lowPass=5000, toFile=FALSE) # plot samples # (only plot every 10th element to accelerate plotting) plot(seq(0,numRecs.AsspDataObj(res) - 1, 10) / rate.AsspDataObj(res), res$audio[c(TRUE, rep(FALSE,9))], type='l', xlab='time (s)', ylab='Audio samples')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # band-pass filter signal between 4000 and 5000 Hz res <- affilter(path2wav, highPass=4000, lowPass=5000, toFile=FALSE) # plot samples # (only plot every 10th element to accelerate plotting) plot(seq(0,numRecs.AsspDataObj(res) - 1, 10) / rate.AsspDataObj(res), res$audio[c(TRUE, rep(FALSE,9))], type='l', xlab='time (s)', ylab='Audio samples')
Function to get or set the data format of an AsspDataObj.
AsspDataFormat(x) AsspDataFormat(x) <- value
AsspDataFormat(x) AsspDataFormat(x) <- value
x |
an object of class AsspDataObj |
value |
an integer or a string indicating the new data format |
libassp
can store data in binary and ASCII format.
This function enables the user to determine the data format of an object
read from file and to set it for subsequent writing.
Valid values are
'ascii'
(or 1
) for ASCII format or 'binary'
(or 2
) for binary IO.
Use is discouraged unless the user knows what they are doing.
a string representing the current data format
for AsspDataFormat<-
, the updated object
Lasse Bombien
Function to get or set the file format of an AsspDataObj.
AsspFileFormat(x) AsspFileFormat(x) <- value
AsspFileFormat(x) AsspFileFormat(x) <- value
x |
an object of class AsspDataObj |
value |
an integer or a string indicating the new file format |
libassp
handles a number of file formats common in speech research.
This function enables the user to determine the file format of an object
read from file and to set it for subsequent writing. This allows for file
format conversion to some degree. Note, that many conversions are not
reasonable/possible: conversions are therefore discouraged unless the user
knows what they are doing. Format specifiers can be found in
AsspFileFormats
and exist in two forms: a code name and a
code number. Both are suitable for setting the format.
for AsspFileFormat
the code name of the object's
currently set file format
for AsspFileFormat<-
, the updated object
Lasse Bombien
AsspFileFormats
, AsspDataFormat
## Not run: obj <- read.AsspDataObj('/path/to/file.wav') AsspFileFormat(obj) AsspFileFormat(obj) <- 'SSFF' ## or AsspFileFormat(obj) <- 20 ## End(Not run)
## Not run: obj <- read.AsspDataObj('/path/to/file.wav') AsspFileFormat(obj) AsspFileFormat(obj) <- 'SSFF' ## or AsspFileFormat(obj) <- 20 ## End(Not run)
list of possibly useful file formats for AsspDataObj corresponding to the first element of the fileInfo attribute
AsspFileFormats
AsspFileFormats
Code Name | code number | description |
RAW | 1 | headerless or unsupported format |
ASP_A | 2 | ASP with ASCII data |
ASP_B | 3 | ASP with binary data |
XASSP | 4 | xassp ASCII |
IPDS_M | 5 | labels in IPdS `MIX' format |
IPDS_S | 6 | labels in IPdS `SAMPA' format |
AIFF | 7 | Apple Audio Interchange File Format |
AIFC | 8 | AIFF extended for compressed data |
CSL | 9 | Kay Elemetrics Computerized Speech Lab |
CSRE | 10 | Computerized Speech Research Environment |
ESPS | 11 | Entropic Signal Processing System |
ILS | 12 | |
KTH | 13 | Kungliga Tekniska Hoegskolan Stockholm |
SWELL | 13 | commercial version of KTH |
SNACK | 13 | as Tcl extension |
SFS | 14 | University College London Speech Filing System |
SND | 15 | NeXT version of `SND' format |
AU | 15 | Sun version of `SND' format |
NIST | 16 | National Institute of Standards and Technology |
SPHERE | 16 | SPeech HEader REsources |
PRAAT_S | 17 | UvA praat 'short' text file |
PRAAT_L | 18 | UvA praat 'long' text file |
PRAAT_B | 19 | UvA praat binary file |
SSFF | 20 | Simple Signal File Format |
WAVE | 21 | IBM/Microsoft RIFF-WAVE |
WAVE_X | 22 | RIFF-WAVE extended format (Revision 3) |
XLABEL | 24 | ESPS xlabel |
YORK | 25 | University of York (Klatt'80 parameters) |
UWM | 26 | University of Wisconsin at Madison (microbeam data) ) |
Lasse Bombien
returns all valid AsspLpTypes according to the assp library
AsspLpTypes()
AsspLpTypes()
wrapper function for AsspLpTypes of wrassp
vector containing lp types
Raphael Winkelmann
returns all valid AsspSpectTypes according to the assp library
AsspSpectTypes()
AsspSpectTypes()
wrapper function for AsspSpectTypes of wrassp
vector containing spectrogram types
Raphael Winkelmann
returns all valid AsspWindowTypes according to the assp library
AsspWindowTypes()
AsspWindowTypes()
wrapper function for AsspWindowTypes of wrassp
vector containing window types
Raphael Winkelmann
calculate cepstral coefficients using libassp
cepstrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
cepstrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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: begin of data) |
centerTime |
= <time>: 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: end of data) |
resolution |
= <freq>: set FFT length to the smallest value which results in a frequency resolution of <freq> Hz or better (default: 40.0) |
fftLength |
= <num>: set FFT length to <num> points (overrules default and 'resolution' option) |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
toFile |
write results to file (default extension depends on ) |
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 |
Short-term cepstral analysis of the signal in <listOfFiles> using the Fast Fourier Transform. The number of coefficients per output record will also equal the FFT length / 2 + 1 (i.e. be non-mirrored). Analysis results will be written to a file with the base name of the input file and as extension '.cep'. Default output is in SSFF format with 'cep' as track name.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
dftSpectrum
, cssSpectrum
, lpsSpectrum
;
all derived from libassp's spectrum function
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calulate cepstrum res <- cepstrum(path2wav, toFile=FALSE) # plot cepstral values at midpoint of signal plot(res$cep[dim(res$cep)[1]/2,], type='l', xlab='cepstral value index', ylab='cepstral value')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calulate cepstrum res <- cepstrum(path2wav, toFile=FALSE) # plot cepstral values at midpoint of signal plot(res$cep[dim(res$cep)[1]/2,], type='l', xlab='cepstral value index', ylab='cepstral value')
calculate cepstrally smoothed spectrum using libassp
cssSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", numCeps = 0, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
cssSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", numCeps = 0, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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: begin of data) |
centerTime |
= <time>: 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: end of data) |
resolution |
= <freq>: set FFT length to the smallest value which results in a frequency resolution of <freq> Hz or better (default: 40.0) |
fftLength |
= <num>: set FFT length to <num> points (overrules default and 'resolution' option) |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
numCeps |
= <num>: set number of cepstral coefficients used to <num> (default: sampling rate in kHz + 1; minimum: 2) |
toFile |
write results to file (default extension depends on ) |
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 |
Short-term spectral analysis of the signal in <listOfFiles> using the Fast Fourier Transform and cepstral smoothing. Analysis results will be written to a file with the base name of the input file and '.css.' as extension. Default output is in SSFF format with 'css' in lower case as track name.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
dftSpectrum
, lpsSpectrum
, cepstrum
;
all derived from libassp's spectrum function.
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate cepstrally smoothed spectrum res <- cssSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$css[dim(res$css)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate cepstrally smoothed spectrum res <- cssSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$css[dim(res$css)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
Remove a track from an AsspDataObj object
delTrack(dobj, trackname)
delTrack(dobj, trackname)
dobj |
An object of class AsspDataObj |
trackname |
the name of a track in this object |
The object without the track named trackname
Lasse Bombien
DFT spectrum function adapted from libassp
dftSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", bandwidth = 0, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
dftSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowShift = 5, window = "BLACKMAN", bandwidth = 0, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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: begin of data) |
centerTime |
= <time>: 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: end of data) |
resolution |
= <freq>: set FFT length to the smallest value which results in a frequency resolution of <freq> Hz or better (default: 40.0) |
fftLength |
= <num>: set FFT length to <num> points (overrules default and 'resolution' option) |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
bandwidth |
= <freq>: set the effective analysis bandwidth to <freq> Hz (default: 0, yielding the smallest possible value given the length of the FFT) |
toFile |
write results to file (default extension depends on ) |
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 |
Short-term spectral analysis of the signal in <listOfFiles> using the Fast Fourier Transform. The default is to calculate an unsmoothed narrow-band spectrum with the size of the analysis window equal to the length of the FFT. The output from the FFT will be converted to a power spectrum in dB from 0 Hz up to and including the Nyquist rate. Analysis results will be written to a file with the base name of the input file and the spectrum type in lower case as extension (e.g. '.dft'). Default output is in SSFF format with the spectrum type in lower case as track name.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
cssSpectrum
, lpsSpectrum
, cepstrum
;
all derived from libassp's spectrum function.
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate dft spectrum res <- dftSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$dft[dim(res$dft)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate dft spectrum res <- dftSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$dft[dim(res$dft)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
Various information on AsspDataObj
dur.AsspDataObj(x) numRecs.AsspDataObj(x) rate.AsspDataObj(x) startTime.AsspDataObj(x)
dur.AsspDataObj(x) numRecs.AsspDataObj(x) rate.AsspDataObj(x) startTime.AsspDataObj(x)
x |
an object of class AsspDataObj |
Some utility function to retrieve duration, number of records, sample rate and so on.
dur: the duration of the AsspDataObj in ms
numRecs: the number of records stored in the AsspDataObj
rate: the data/sample rate of the AsspDataObj in Hz
startTime: start time of the first sample of the AsspDataObj
Lasse Bombien
forest function adapted from libassp
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, verbose = TRUE )
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, verbose = TRUE )
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 data) |
endTime |
= <time>: set end of analysis interval to <time> seconds (default = 0: end of data) |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
windowSize |
= <dur>: set analysis window size to <dur> ms (default: 30.0) |
effectiveLength |
make window size effective rather than exact |
nominalF1 |
= <freq>: set nominal F1 frequency to <freq> Hz (default: 500.0 Hz) |
gender |
= <code>: set gender specific parameters where <code> = f[emale], m[ale] or u[nknown] (when <code>=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 |
= <num>: set number of formants to <num> (default: 4; maximum: 8 or half the LP order) |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
preemphasis |
= <val>: set pre-emphasis factor to <val> (-1 <= val <= 0) (default: dependent on sample rate and nominal F1) |
toFile |
write results to file (default extension is .fms) |
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 |
Formant estimation of the signal(s) in <listOfFiles>. 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 frequency 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')
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# 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)')
# 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)')
Checks whether x is a valid AsspDataObj
is.AsspDataObj(x, ...)
is.AsspDataObj(x, ...)
x |
an object of class AsspDataObj |
... |
optional other arguments passed to further functions |
TRUE or FALSE
Lasse Bombien
checks if given string is a valid AsspLpType according to the assp library
isAsspLpType(lpName = NULL)
isAsspLpType(lpName = NULL)
lpName |
name of lp type |
(BOOL) true if lpName is valid; false otherwise
Raphael Winkelmann
checks if given string is a valid AsspSpectType according to the assp library
isAsspSpectType(spectName = NULL)
isAsspSpectType(spectName = NULL)
spectName |
name of lp type |
(BOOL) true if spectName is valid; false otherwise
Raphael Winkelmann
checks if given string is a valid AsspWindowType according to the assp library
isAsspWindowType(windowName = NULL)
isAsspWindowType(windowName = NULL)
windowName |
name of window |
(BOOL) true if windowName is valid; false otherwise
Raphael Winkelmann
ksvF0 function adapted from libassp
ksvF0( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, endTime = 0, windowShift = 5, gender = "u", maxF = 600, minF = 50, minAmp = 50, maxZCR = 3000, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
ksvF0( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, endTime = 0, windowShift = 5, gender = "u", maxF = 600, minF = 50, minAmp = 50, maxZCR = 3000, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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 data) |
endTime |
set end of analysis interval to <time> seconds (default = 0: end of data) |
windowShift |
= <dur>: set frame shift to <dur> ms (default: 5.0) |
gender |
= <code> set gender-specific F0 ranges; <code> may be: "f[emale]" (80.0 - 640.0 Hz) "m[ale]" (50.0 - 400.0 Hz) "u[nknown]" (default; 50.0 - 600.0 Hz) |
maxF |
= <freq>: set maximum F0 value to <freq> Hz (default: 500.0) |
minF |
= <freq>: set minimum F0 value to <freq> Hz (default: 50.0) |
minAmp |
= <amp>: set amplitude threshold for voiced samples to <amp> (default: 100) |
maxZCR |
maximum zero crossing rate in Hz (for voicing detection) |
toFile |
write results to file (default extension is .f0) |
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 |
F0 analysis of the signal in <listOfFiles> using the K. Schaefer-Vincent periodicity detection algorithm. Analysis results will be written to a file with the base name of the input file and extension '.f0'. Default output is in SSFF binary format (track 'F0'). Optionally, location and type of the signal extrema on which the F0 data are based, may be stored in a label file. The name of this file will consist of the base name of the F0 file and the extension '.prd'.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
Schaefer-Vincent K (1983) Pitch period detection and chaining: method and evaluation. Phonetica 1983, Vol 40, pp. 177-202
mhsF0
for an alternative pitch tracker
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate fundamental frequency contour res <- ksvF0(path2wav, toFile=FALSE) # plot the fundamental frequency contour plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$F0, type='l', xlab='time (s)', ylab='F0 frequency (Hz)')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate fundamental frequency contour res <- ksvF0(path2wav, toFile=FALSE) # plot the fundamental frequency contour plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$F0, type='l', xlab='time (s)', ylab='F0 frequency (Hz)')
Calculate Linear Prediction smoothed spectrum using libassp
lpsSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowSize = 20, windowShift = 5, window = "BLACKMAN", order = 0, preemphasis = -0.95, deemphasize = TRUE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
lpsSpectrum( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, resolution = 40, fftLength = 0, windowSize = 20, windowShift = 5, window = "BLACKMAN", order = 0, preemphasis = -0.95, deemphasize = TRUE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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: begin of data) |
centerTime |
= <time>: 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: end of data) |
resolution |
= <freq>: set FFT length to the smallest value which results in a frequency resolution of <freq> Hz or better (default: 40.0) |
fftLength |
= <num>: set FFT length to <num> points (overrules default and 'resolution' option) |
windowSize |
= <dur>: set effective analysis window size to <dur> ms |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
window |
= <type>: set analysis window function to <type> (default: BLACKMAN) |
order |
= <num>: set prediction order to <num> (default: sampling rate in kHz + 3) |
preemphasis |
= <val>: set pre-emphasis factor to <val> (default: -0.95) |
deemphasize |
(default: undo spectral tilt due to pre-emphasis used in LP analysis, i.e. TRUE) |
toFile |
write results to file (default extension depends on ) |
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 |
Short-term spectral analysis of the signal in <listOfFiles> using the Fast Fourier Transform and linear predictive smoothing. Analysis results will be written to a file with the base name of the input file and the spectrum type in lower case as extension (i.e. '.lps'). Default output is in SSFF format with the spectrum type in lower case as track name.
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
dftSpectrum
, cssSpectrum
, cepstrum
;
all derived from libassp's spectrum function.
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate lps spectrum res <- lpsSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$lps[dim(res$lps)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate lps spectrum res <- lpsSpectrum(path2wav, toFile=FALSE) # plot spectral values at midpoint of signal plot(res$lps[dim(res$lps)[1]/2,], type='l', xlab='spectral value index', ylab='spectral value')
mhsF0 function adapted from libassp
mhsF0( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, gender = "u", maxF = 600, minF = 50, minAmp = 50, minAC1 = 0.25, minRMS = 18, maxZCR = 3000, minProb = 0.52, plainSpectrum = FALSE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
mhsF0( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, gender = "u", maxF = 600, minF = 50, minAmp = 50, minAC1 = 0.25, minRMS = 18, maxZCR = 3000, minProb = 0.52, plainSpectrum = FALSE, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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 |
= <time>: 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) |
gender |
= <code> set gender-specific pitch ranges; <code> may be: "f[emale]" (80.0 - 600.0 Hz) "m[ale]" (50.0 - 375.0 Hz) "u[nknown]" (default; 50.0 - 600.0 Hz) |
maxF |
= <freq>: set maximum pitch value to <freq> Hz (default: 500.0) |
minF |
= <freq>: set minimum pitch value to <freq> Hz (default: 50.0 minimum: 25.0) |
minAmp |
= <amp>: minimum signal amplitude (default: 50) |
minAC1 |
= <freq>: minimum 1st correlation coefficient (default: 0.250) |
minRMS |
= <num>: minimum RMS amplitude in dB (default: 18.0) |
maxZCR |
= <freq>: maximum zero crossing rate in Hz (default: 3000) |
minProb |
= <num>: minimum quality value of F0 fit (default: 0.520) |
plainSpectrum |
use plain rather than masked power spectrum |
toFile |
write results to file (default extension is .pit) |
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 |
Pitch analysis of the speech signal in <listOfFile> using Michel's/Modified Harmonic Sieve algorithm. Analysis results will be written to a file with the base name of the input file and extension '.pit'. Default output is in SSFF binary format (track 'pitch').
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
ksvF0
for an tracking the fundamental frequency
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate fundamental frequency contour res <- mhsF0(path2wav, toFile=FALSE) # plot fundamental frequency contour plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$pitch, type='l', xlab='time (s)', ylab='F0 frequency (Hz)')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate fundamental frequency contour res <- mhsF0(path2wav, toFile=FALSE) # plot fundamental frequency contour plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$pitch, type='l', xlab='time (s)', ylab='F0 frequency (Hz)')
Normalise a list of filenames so that they can be passed to a signal processing function
prepareFiles(listOfFiles)
prepareFiles(listOfFiles)
listOfFiles |
The list of file names to process |
A normalised list of filenames
Raphael Winkelmann
# listOfFiles <- prepareFiles(listOfFiles)
# listOfFiles <- prepareFiles(listOfFiles)
Prints an overview of ASSP Data Objects
## S3 method for class 'AsspDataObj' print(x, ...)
## S3 method for class 'AsspDataObj' print(x, ...)
x |
an object of class AsspDataObj |
... |
other arguments that might be passed on to other functions |
Lasse Bombien
read.AsspDataObj creates an object of class dobj from a signal or parameter file readable by the ASSP Library (WAVE, SSFF, AU, ...)
read.AsspDataObj(fname, begin = 0, end = 0, samples = FALSE)
read.AsspDataObj(fname, begin = 0, end = 0, samples = FALSE)
fname |
filename of the signal or parameter file |
begin |
begin time (default is in seconds) of segment to retrieve |
end |
end time (default is in seconds) of segment to retrieve |
samples |
(BOOL) if set to false seconds values of begin/end are sample numbers |
list object containing file data
Lasse Bombien
rfcana function adapted from libassp
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 )
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 )
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 |
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).
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# 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')
# 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')
rmsana function adapted from libassp
rmsana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 20, effectiveLength = TRUE, linear = FALSE, window = "HAMMING", toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
rmsana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 20, effectiveLength = TRUE, linear = FALSE, window = "HAMMING", toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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 |
= <time>: 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: 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 |
linear |
calculate linear RMS values (default: values in dB) |
window |
= <type>: set analysis window function to <type> (default: HAMMING) |
toFile |
write results to file (default extension is .rms) |
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 |
Analysis of short-term Root Mean Square amplitude of the signal in <listOfFiles>. Per default, the RMS values are expressed in decibel (dB) so that they correspond to the short-term power of the signal. Analysis results will be written to a file with the base name of the input file and extension '.rms'. Default output is in SSFF binary format (track 'rms').
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate rms values res <- rmsana(path2wav, toFile=FALSE) # plot rms values plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$rms, type='l', xlab='time (s)', ylab='RMS energy (dB)')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate rms values res <- rmsana(path2wav, toFile=FALSE) # plot rms values plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$rms, type='l', xlab='time (s)', ylab='RMS energy (dB)')
List the tracks of an AsspDataObj
tracks.AsspDataObj(x)
tracks.AsspDataObj(x)
x |
an object of class AsspDataObj |
AsspDataObj contain tracks (at least one). This function lists the names
of these tracks. This function is equivalent to calling names(x)
.
a character vector containing the names of the tracks
Lasse Bombien
package variable to force the usage of the logger set to FALSE by default
useWrasspLogger
useWrasspLogger
An object of class logical
of length 1.
Raphael Winkelmann
Designated logger for the wrassp signal processing functions
wrassp.logger(fName, fOpts, optLogFilePath, listOfFiles)
wrassp.logger(fName, fOpts, optLogFilePath, listOfFiles)
fName |
the name of the function calling the logger |
fOpts |
are the function options given by the user acquired by match.call |
optLogFilePath |
path to option log file |
listOfFiles |
vector of file paths that the spf calling the logger processed |
Function logs the call to a signal processing function (spf) of wrassp. It is called by default if the forceToLog option of the spf is not set to false. I tries to format the output in an easily readable fashion.
Raphael Winkelmann
list of default output extensions, track names and output type for each signal processing function in wrassp
wrasspOutputInfos
wrasspOutputInfos
An object of class list
of length 13.
Raphael Winkelmann
Writes an object of class AsspDataObj to a file given the meta information contained in the object.
write.AsspDataObj(dobj, file = attr(dobj, "filePath"))
write.AsspDataObj(dobj, file = attr(dobj, "filePath"))
dobj |
an object of class AsspDataObj |
file |
file name as a character string, defaults to the
|
Lasse Bombien
zcrana function adapted from libassp
zcrana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 25, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
zcrana( listOfFiles = NULL, optLogFilePath = NULL, beginTime = 0, centerTime = FALSE, endTime = 0, windowShift = 5, windowSize = 25, toFile = TRUE, explicitExt = NULL, outputDirectory = NULL, forceToLog = useWrasspLogger, verbose = TRUE )
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: begin of file) |
centerTime |
= <time> 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: end of file) |
windowShift |
= <dur>: set analysis window shift to <dur> ms (default: 5.0) |
windowSize |
= <dur>: set analysis window size to <dur> ms (default: 25.0) |
toFile |
write results to file (default extension is .zcr) |
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 |
Analysis of the averages of the short-term positive and negative zero-crossing rates of the signal in <listOfFiles>. Analysis results will be written to a file with the base name of the input file and extension '.zcr'. Default output is in SSFF binary format (track 'zcr').
nrOfProcessedFiles or if only one file to process return AsspDataObj of that file
Raphael Winkelmann
Lasse Bombien
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate zcr values res <- zcrana(path2wav, toFile=FALSE) # plot zcr values plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$zcr, type='l', xlab='time (s)', ylab='ZCR values')
# get path to audio file path2wav <- list.files(system.file("extdata", package = "wrassp"), pattern = glob2rx("*.wav"), full.names = TRUE)[1] # calculate zcr values res <- zcrana(path2wav, toFile=FALSE) # plot zcr values plot(seq(0,numRecs.AsspDataObj(res) - 1) / rate.AsspDataObj(res) + attr(res, 'startTime'), res$zcr, type='l', xlab='time (s)', ylab='ZCR values')