nnmnkwii.preprocessing.inv_modspec¶
-
nnmnkwii.preprocessing.inv_modspec(ms, phase, norm=None)[source]¶ Inverse transform of modulation spectrum computation
Given an modulation spectrum and it’s phase, it recovers original parameter trajectory.
Note
Returned parameter trajectory has shape (
n x D), wherenis DFT length used in modulation spectrum compuattion. You will have to trim it yourself to the actual time length if needed.Warning
This may move in different module in future.
- Parameters
ms (numpy.ndarray) – Modulation spectrum (
n//2 + 1 x D).phase (numpy.ndarray) – Phase of modulation spectrum (
n//2 + 1 x D).norm (str) – Normalization mode. See
numpy.fft.fft().
- Returns
Recovered parameter trajectory, shape (
n x D).- Return type
Examples
>>> import numpy as np >>> from nnmnkwii import preprocessing as P >>> generated = np.random.rand(10, 2) >>> ms, phase = P.modspec(generated, n=16, return_phase=True) >>> generated_hat = P.inv_modspec(ms, phase)[:len(generated)] >>> assert np.allclose(generated, generated_hat)
See also