mdct.fast module¶
Module for calculating lapped MDCT using FFT
Warning
Functions defined in this module are exposed using the mdct
module itself, please do not use this module directly.

mdct.fast.
mdct
(x, odd=True, transforms=None, **kwargs)¶ Calculate lapped MDCT of input signal
Parameters:  x (array_like) – The signal to be transformed. May be a 1D vector for single channel or
a 2D matrix for multi channel data. In case of a mono signal, the data
is must be a 1D vector of length
samples
. In case of a multi channel signal, the data must be in the shape ofsamples x channels
.  odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  framelength (int) – The signal frame length. Defaults to
2048
.  hopsize (int) – The signal frame hopsize. Defaults to
None
. Setting this value will overrideoverlap
.  overlap (int) – The signal frame overlap coefficient. Value
x
means1/x
overlap. Defaults to2
. Note that anything but2
will result in a filterbank without perfect reconstruction.  centered (boolean) – Pad input signal so that the first and last window are centered around
the beginning of the signal. Defaults to
True
. Disabling this will result in aliasing in the first and last halfframe.  window (callable, array_like) – Window to be used for deringing. Can be
False
to disable windowing. Defaults toscipy.signal.cosine
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
 padding (int) – Zeropad signal with x times the number of samples.
Defaults to
0
.  save_settings (boolean) – Save settings used here in attribute
out.stft_settings
so thatispectrogram()
can infer these settings without the developer having to pass them again.
Returns: out – The signal (or matrix of signals). In case of a mono output signal, the data is formatted as a 1D vector of length
samples
. In case of a multi channel output signal, the data is formatted assamples x channels
.Return type: array_like
See also
 x (array_like) – The signal to be transformed. May be a 1D vector for single channel or
a 2D matrix for multi channel data. In case of a mono signal, the data
is must be a 1D vector of length

mdct.fast.
imdct
(X, odd=True, transforms=None, **kwargs)¶ Calculate lapped inverse MDCT of input signal
Parameters:  x (array_like) – The spectrogram to be inverted. May be a 2D matrix for single channel
or a 3D tensor for multi channel data. In case of a mono signal, the
data must be in the shape of
bins x frames
. In case of a multi channel signal, the data must be in the shape ofbins x frames x channels
.  odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  framelength (int) – The signal frame length. Defaults to infer from data.
 hopsize (int) – The signal frame hopsize. Defaults to infer from data. Setting this
value will override
overlap
.  overlap (int) – The signal frame overlap coefficient. Value
x
means1/x
overlap. Defaults to infer from data. Note that anything but2
will result in a filterbank without perfect reconstruction.  centered (boolean) – Pad input signal so that the first and last window are centered around the beginning of the signal. Defaults to to infer from data. The first and last halfframe will have aliasing, so using centering during forward MDCT is recommended.
 window (callable, array_like) – Window to be used for deringing. Can be
False
to disable windowing. Defaults to to infer from data.  halved (boolean) – Switch to reconstruct the other halve of the spectrum if the forward transform has been truncated. Defaults to to infer from data.
 transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
 padding (int) – Zeropad signal with x times the number of samples. Defaults to infer from data.
 outlength (int) – Crop output signal to length. Useful when input length of spectrogram did not fit into framelength and input data had to be padded. Not setting this value will disable cropping, the output data may be longer than expected.
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.imdct()
 inverse MDCT
 x (array_like) – The spectrogram to be inverted. May be a 2D matrix for single channel
or a 3D tensor for multi channel data. In case of a mono signal, the
data must be in the shape of

mdct.fast.
mdst
(x, odd=True, transforms=None, **kwargs)¶ Calculate lapped MDST of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
Additional keyword arguments passed tostft.spectrogram
Returns: out – The output signal
Return type: array_like
See also

mdct.fast.
imdst
(X, odd=True, transforms=None, **kwargs)¶ Calculate lapped inverse MDST of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
Additional keyword arguments passed tostft.spectrogram
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.imdst()
 inverse MDST

mdct.fast.
cmdct
(x, odd=True, transforms=None, **kwargs)¶ Calculate lapped complex MDCT/MCLT of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
 optional (**kwargs,) –
Additional keyword arguments passed to
stft.spectrogram
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.cmdct()
 complex MDCT

mdct.fast.
icmdct
(X, odd=True, transforms=None, **kwargs)¶ Calculate lapped inverse complex MDCT/MCLT of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
Additional keyword arguments passed tostft.spectrogram
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.icmdct()
 inverse complex MDCT

mdct.fast.
mclt
(x, odd=True, transforms=None, **kwargs)¶ Calculate lapped complex MDCT/MCLT of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
 optional (**kwargs,) –
Additional keyword arguments passed to
stft.spectrogram
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.cmdct()
 complex MDCT

mdct.fast.
imclt
(X, odd=True, transforms=None, **kwargs)¶ Calculate lapped inverse complex MDCT/MCLT of input signal
Parameters:  x (array_like) – The input signal
 odd (boolean, optional) – Switch to oddly stacked transform. Defaults to
True
.  transforms (module, optional) – Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
mdct.fast
Additional keyword arguments passed tostft.spectrogram
Returns: out – The output signal
Return type: array_like
See also
mdct.fast.transforms.icmdct()
 inverse complex MDCT