View source: R/wrassp_cepstrum.R
cepstrum | R Documentation |
This function performs a cepstral analysis \insertCiteOppenheim.2004.10.1109/msp.2004.1328092,Childers.1977.10.1109/proc.1977.10747superassp on the signals in listOfFiles
using the Fast Fourier Transform. The number of
coefficients per output record will also equal the
FFT length / 2 + 1 (which means that it will not be mirrored).
The results will be will be written to an SSFF formated file with the base name of the input file and extension .cep in a track CdB which contains amplitudes of at each ½ Quefrency (in ms).
cepstrum(
listOfFiles = NULL,
optLogFilePath = NULL,
beginTime = 0,
centerTime = FALSE,
endTime = 0,
resolution = 40,
fftLength = 0,
windowShift = 5,
window = "BLACKMAN",
toFile = TRUE,
explicitExt = "cep",
outputDirectory = NULL,
assertLossless = NULL,
logToFile = FALSE,
keepConverted = FALSE,
verbose = TRUE
)
listOfFiles |
vector of file paths to be processed by function |
beginTime |
the time point (in seconds) of the start of the analysed
interval. A NULL or 0 is interpreted as the start of the signal file.
If a vector of time points is supplied, the length of that vector needs
to correspond with the length of |
centerTime |
sets a single-frame analysis time point (in seconds).
Overrides |
endTime |
the time point (in seconds) of the end of the analysed
interval. A NULL or 0 is interpreted as the end of the signal file.
If a vector of time points is supplied, the length of that vector needs
to correspond with the length of |
resolution |
= |
fftLength |
= |
windowShift |
the amount of time (in ms) that the analysis window will be shifted between analysis frames |
window |
= the analysis window function type ("BLACKMAN" by default). See AsspWindowTypes for a list of supported window types. |
toFile |
Should the function write the results to a file, with the
(default) file extension ( |
explicitExt |
the file extension will be used when
result files are written ( |
outputDirectory |
directory in which output files are stored. Defaults to NULL which means that the result file will be stored in the same directory as the input file. |
assertLossless |
an optional list of file extensions that the user wants to assert contains losslessly encoded signals data. |
logToFile |
whether to log commands to a separate logfile in the
|
verbose |
display verbose information about processing steps taken, as well as progress bars. |
The function is a re-write of the wrassp::cepstrum function, but with media pre-conversion, better checking of preconditions such as the input file existance, structured logging, and the use of a more modern framework for user feedback.
The native file type of this function is "wav" files (in "pcm_s16le" format), SUNs "au", NIST, or CSL formats (kay or NSP extension). Input signal conversion, when needed, is done by libavcodec and the excellent av::av_audio_convert wrapper function
The number of successfully written files (if toFile=TRUE
), or a vector of AsspDataObj
objects (if toFile=FALSE
).
This function takes some time to apply but also result in data in a relatively large matrix. It is therefore not usually efficient to store intermediate results in a cache. However, if the number of signals it will be applied to is very large, then caching of results may be warranted.
Raphael Winkelmann
Lasse Bombien
Fredrik Nylén
dftSpectrum
, cssSpectrum
, lpsSpectrum
;
all derived from libassp's spectrum function
wrassp::cepstrum
AsspWindowTypes
av::av_audio_convert
# get path to audio file
path2wav <- list.files(system.file("samples","sustained", package = "superassp"), pattern = glob2rx("a1.wav"), full.names = TRUE)
# calulate cepstrum
res <- cepstrum(path2wav, toFile=FALSE)
# plot cepstral values at midpoint of signal
plot(y=res[["C[dB]"]][400,],
x=seq(1,ncol(res[["C[dB]"]])),
type='l',
xlab='Quefrency (ms)',
ylab='Amplitude (dB)')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.