librosa.display.Transformf0#
- class librosa.display.Transformf0(f0, *, sr=22050, hop_length=512, bins_per_octave=12, norm=1, offset=0, transpose=False, is_inverted=False)[source]#
A utility class to handle f0-displacement for waveform visualizations.
- Parameters:
- f0np.ndarray
Array of fundamental frequency values (in Hz), one per frame. Values may be NaN for unvoiced frames.
- srnumber > 0
Audio sampling rate, used with
hop_lengthto compute time stamps.- hop_lengthint > 0
Number of audio samples between successive f0 frames.
- bins_per_octaveint > 0
Number of bins per octave used for the pitch axis.
- normfloat
Normalization factor applied to the pitch axis.
- offsetfloat
Time offset (in seconds) applied to the frame time stamps.
- transposebool
If
True, the time axis is the second dimension instead of the first.- is_invertedbool
If
True, apply the inverse of the f0-displacement transformation.
- __init__(f0, *, sr=22050, hop_length=512, bins_per_octave=12, norm=1, offset=0, transpose=False, is_inverted=False)[source]#
- Parameters:
- shorthand_namestr
A string representing the “name” of the transform. The name carries no significance other than to improve the readability of
str(transform)when DEBUG=True.
Methods
inverted()Return the inverse of this transformation.
transform_non_affine(values)Apply the f0 displacement transformation to the given values.
- inverted()[source]#
Return the inverse of this transformation.
- Returns:
- Transformf0
A new
Transformf0withis_invertedtoggled.
- transform_non_affine(values)[source]#
Apply the f0 displacement transformation to the given values.
- Parameters:
- valuesnp.ndarray
An array of shape (…, 2) containing time and sample values to be transformed. The order of time and sample values is determined by the transpose parameter of this class.
- Returns:
- outputnp.ndarray
An array of the same shape as values, containing the transformed time and sample values.
Attributes
Return the number of transforms which have been chained together to form this Transform instance.
True if this transform has a corresponding inverse transform.
The number of input dimensions of this transform.
True if this transform is separable in the x- and y- dimensions.
The number of output dimensions of this transform.
If pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.
- depth#
Return the number of transforms which have been chained together to form this Transform instance.
Note
For the special case of a Composite transform, the maximum depth of the two is returned.
- has_inverse = True#
True if this transform has a corresponding inverse transform.
- input_dims = None#
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
- is_affine = False#
- is_separable = False#
True if this transform is separable in the x- and y- dimensions.
- output_dims = None#
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
- pass_through = False#
If pass_through is True, all ancestors will always be invalidated, even if ‘self’ is already invalid.
- f0_interp#
- norm#
- bins_per_octave#
- f0#
- sr#
- hop_length#
- offset#
- transpose#
- is_inverted#