Skip to content

Commit

Permalink
Added parameters from stft to our transforms, for better readability …
Browse files Browse the repository at this point in the history
…of docs
  • Loading branch information
nils-werner committed Jul 11, 2016
1 parent 67db002 commit a990cd5
Showing 1 changed file with 67 additions and 5 deletions.
72 changes: 67 additions & 5 deletions mdct/fast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,49 @@ def mdct(
Parameters
----------
x : array_like
The input signal
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 :code:`samples`. In case of a multi
channel signal, the data must be in the shape of :code:`samples x
channels`.
odd : boolean, optional
Switch to oddly stacked transform. Defaults to :code:`True`.
framelength : int
The signal frame length. Defaults to :code:`2048`.
hopsize : int
The signal frame hopsize. Defaults to :code:`None`. Setting this
value will override :code:`overlap`.
overlap : int
The signal frame overlap coefficient. Value :code:`x` means
:code:`1/x` overlap. Defaults to :code:`2`. Note that anything but
:code:`2` 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 :code:`True`.
Disabling this will result in aliasing
in the first and last half-frame.
window : callable, array_like
Window to be used for deringing. Can be :code:`False` to disable
windowing. Defaults to :code:`scipy.signal.cosine`.
transforms : module, optional
Module reference to core transforms. Mostly used to replace
fast with slow core transforms, for testing. Defaults to
:mod:`mdct.fast`
Additional keyword arguments passed to :code:`stft.spectrogram`
padding : int
Zero-pad signal with x times the number of samples.
Defaults to :code:`0`.
save_settings : boolean
Save settings used here in attribute :code:`out.stft_settings` so that
:func:`ispectrogram` can infer these settings without the developer
having to pass them again.
Returns
-------
out : array_like
The output signal
The signal (or matrix of signals). In case of a mono output signal, the
data is formatted as a 1D vector of length :code:`samples`. In case of
a multi channel output signal, the data is formatted as :code:`samples
x channels`.
See Also
--------
Expand Down Expand Up @@ -84,14 +114,46 @@ def imdct(
Parameters
----------
x : array_like
The input signal
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 :code:`bins x frames`. In case of a multi
channel signal, the data must be in the shape of :code:`bins x frames x
channels`.
odd : boolean, optional
Switch to oddly stacked transform. Defaults to :code:`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 :code:`overlap`.
overlap : int
The signal frame overlap coefficient. Value :code:`x` means
:code:`1/x` overlap. Defaults to infer from data. Note that anything
but :code:`2` 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 half-frame will have aliasing, so using
centering during forward MDCT is recommended.
window : callable, array_like
Window to be used for deringing. Can be :code:`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
:mod:`mdct.fast`
Additional keyword arguments passed to :code:`stft.spectrogram`
padding : int
Zero-pad 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
-------
Expand Down

0 comments on commit a990cd5

Please sign in to comment.