Learn R Programming

wrassp (version 0.1.2)

lpsSpectrum: lpsSpectrum

Description

Calculate Linear Prediction smoothed spectrum using libassp

Usage

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)

Arguments

listOfFiles
vector of file paths to be processed by function
optLogFilePath
path to option log file
beginTime
=
centerTime
=
endTime
=
resolution
= : set FFT length to the smallest value which results in a freqequency resolution of Hz or better (default: 40.0)
fftLength
= : set FFT length to points (overrules default and 'resolution' option)
windowSize
= : set effective analysis window size to ms
windowShift
= : set analysis window shift to ms (default: 5.0)
window
= : set analysis window function to (default: BLACKMAN)
order
= : set prediction order to (default: sampling rate in kHz + 3)
preemphasis
= : set pre-emphasis factor to (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 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

Short-term spectral analysis of the signal in 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.

See Also

dftSpectrum, cssSpectrum, cepstrum; all derived from libassp's spectrum function.

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 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')

Run the code above in your browser using DataLab