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
__delattr__(name, /)Implement delattr(self, name).
__dir__(/)Default dir() implementation.
__eq__(value, /)Return self==value.
__format__(format_spec, /)Default object formatter.
__ge__(value, /)Return self>=value.
__getattribute__(name, /)Return getattr(self, name).
__gt__(value, /)Return self>value.
__hash__(/)Return hash(self).
__init__(f0, *[, sr, hop_length, ...])__le__(value, /)Return self<=value.
__lt__(value, /)Return self<value.
__ne__(value, /)Return self!=value.
__new__(*args, **kwargs)__reduce__(/)Helper for pickle.
__reduce_ex__(protocol, /)Helper for pickle.
__repr__(/)Return repr(self).
__setattr__(name, value, /)Implement setattr(self, name, value).
__sizeof__(/)Size of object in memory, in bytes.
__str__(/)Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
inverted()Return the inverse of this transformation.
transform_non_affine(values)Apply the f0 displacement transformation to the given values.
Attributes
_INVALID_AFFINE_ONLY_INVALID_FULL_VALID__annotations____dict____doc____module____weakref__list of weak references to the object
depthReturn the number of transforms which have been chained together to form this Transform instance.
has_inverseTrue if this transform has a corresponding inverse transform.
input_dimsThe number of input dimensions of this transform.
is_affineis_separableTrue if this transform is separable in the x- and y- dimensions.
output_dimsThe number of output dimensions of this transform.
pass_throughIf pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.
f0_interpnormbins_per_octavef0srhop_lengthoffsettransposeis_inverted