View source: R/modulationSpectrum_utilities.R
specToMS | R Documentation |
Takes a spectrogram (either complex or magnitude) and returns a MS with proper row and column labels.
specToMS(spec, windowLength = NULL, step = NULL)
spec |
target spectrogram (numeric matrix, frequency in rows, time in columns) |
windowLength |
length of FFT window, ms |
step |
you can override |
Returns a MS - matrix of complex values of the same dimension as spec, with AM in rows and FM in columns.
s = soundgen(sylLen = 500, amFreq = 25, amDep = 50,
pitch = 250, samplingRate = 16000)
spec = spectrogram(s, samplingRate = 16000, windowLength = 25, step = 5, plot = FALSE)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.