librosa.display.AdaptiveWaveplot#

class librosa.display.AdaptiveWaveplot(times, y, steps, envelope, sr=22050, max_samples=11025, transpose=False, label=None)[source]#

A helper class for managing adaptive wave visualizations.

This object is used to dynamically switch between sample-based and envelope-based visualizations of waveforms. When the display is zoomed in such that no more than max_samples would be visible, the sample-based display is used. When displaying the raw samples would require more than max_samples, an envelope-based plot is used instead.

You should never need to instantiate this object directly, as it is constructed automatically by waveshow.

Parameters:
timesnp.ndarray

An array containing the time index (in seconds) for each sample.

ynp.ndarray

An array containing the (monophonic) wave samples.

stepsmatplotlib.lines.Line2D

The matplotlib artist used for the sample-based visualization. This is constructed by matplotlib.pyplot.step.

envelopematplotlib.collections.PolyCollection

The matplotlib artist used for the envelope-based visualization. This is constructed by matplotlib.pyplot.fill_between.

srnumber > 0

The sampling rate of the audio

max_samplesint > 0

The maximum number of samples to use for sample-based display.

transposebool

If True, display the wave vertically instead of horizontally.

labelstr or None

An optional label for the waveplot, used in legend entries.

See also

waveshow
__init__(times, y, steps, envelope, sr=22050, max_samples=11025, transpose=False, label=None)[source]#

Methods

__del__()

Disconnect callback methods on delete

__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).

__getstate__(/)

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__(/)

Return hash(self).

__init__(times, y, steps, envelope[, sr, ...])

__init_subclass__

This method is called when a class is subclassed.

__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().

connect(ax, *[, signal])

Connect the adaptor to a signal on an axes object.

disconnect(*[, strict])

Disconnect the adaptor's update callback.

update(ax)

Update the matplotlib display according to the current viewport limits.

Attributes

__annotations__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object

ax

The connected Axes, or None if not connected or garbage collected.

envelope

The envelope artist (PolyCollection), or None if garbage collected.

steps

The step plot artist (Line2D), or None if garbage collected.

times

samples

sr

max_samples

transpose

cid

label_proxy_