View source: R/modulationSpectrum_utilities.R
| msToSpec | R Documentation | 
Takes a complex MS and transforms it to a complex spectrogram with proper row (frequency) and column (time) labels.
msToSpec(ms, windowLength = NULL, step = NULL)
| ms | target modulation spectrum (matrix of complex numbers) | 
| windowLength | length of FFT window, ms (multiple values in a vector produce a multi-resolution spectrogram) | 
| step | you can override  | 
Returns a spectrogram - a numeric matrix of complex numbers of the same dimensions as ms.
s = soundgen(sylLen = 250, amFreq = 25, amDep = 50,
             pitch = 250, samplingRate = 16000)
spec = spectrogram(s, samplingRate = 16000, windowLength = 25, step = 5)
ms = specToMS(spec)
plotMS(log(Mod(ms)), quantiles = NULL, col = soundgen:::jet.col(100))
spec_new = msToSpec(ms)
spectrogram(s, specManual = Mod(spec_new))
## Not run: 
# or plot manually
image(x = as.numeric(colnames(spec_new)), y = as.numeric(rownames(spec_new)),
      z = t(log(abs(spec_new))), xlab = 'Time, ms',
      ylab = 'Frequency, kHz')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.