specToMS {soundgen} | R Documentation |
Spectrogram to modulation spectrum
Description
Takes a spectrogram (either complex or magnitude) and returns a MS with proper row and column labels.
Usage
specToMS(spec, windowLength = NULL, step = NULL)
Arguments
spec |
target spectrogram (numeric matrix, frequency in rows, time in columns) |
windowLength |
length of FFT window, ms |
step |
you can override |
Value
Returns a MS - matrix of complex values of the same dimension as spec, with AM in rows and FM in columns.
Examples
s = soundgen(sylLen = 500, amFreq = 25, amDep = 50,
pitch = 250, samplingRate = 16000)
spec = spectrogram(s, samplingRate = 16000, windowLength = 25, step = 5)
ms = specToMS(spec)
image(x = as.numeric(colnames(ms)), y = as.numeric(rownames(ms)),
z = t(log(abs(ms))), xlab = 'Amplitude modulation, Hz',
ylab = 'Frequency modulation, cycles/kHz')
abline(h = 0, lty = 3); abline(v = 0, lty = 3)
[Package soundgen version 2.6.3 Index]