Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.
librosa.display.AdaptiveWaveplot¶
- class librosa.display.AdaptiveWaveplot(times, y, steps, envelope, sr=22050, max_samples=11025)[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.Lines2D
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.
See also
Methods
__init__
(times, y, steps, envelope[, sr, ...])update
(ax)Update the matplotlib display according to the current viewport limits.