librosa.display.AdaptiveWaveplot

class librosa.display.AdaptiveWaveplot(times, y, steps, envelope, sr=22050, max_samples=11025, transpose=False)[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.

See also

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

Methods

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

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.