R: dftSpectrum

dftSpectrum {wrassp} | R Documentation

## dftSpectrum

### Description

DFT spectrum function adapted from libassp

### Usage

    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)

### 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: 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 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.
`verbose` | display infos & show progress bar

### Details

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.

### Value

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

### Author(s)

Raphael Winkelmann

Lasse Bombien

### See Also

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

### Examples

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

[Package wrassp version 0.1.4 Index]