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_length to 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

depth

Return the number of transforms which have been chained together to form this Transform instance.

has_inverse

True if this transform has a corresponding inverse transform.

input_dims

The number of input dimensions of this transform.

is_affine

is_separable

True if this transform is separable in the x- and y- dimensions.

output_dims

The number of output dimensions of this transform.

pass_through

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