def waveplot(y, sr=<NUM_LIT>, max_points=<NUM_LIT>, x_axis='<STR_LIT:time>', offset=<NUM_LIT:0.0>,<EOL>max_sr=<NUM_LIT:1000>, ax=None, **kwargs):
util.valid_audio(y, mono=False)<EOL>if not (isinstance(max_sr, int) and max_sr > <NUM_LIT:0>):<EOL><INDENT>raise ParameterError('<STR_LIT>')<EOL><DEDENT>target_sr = sr<EOL>hop_length = <NUM_LIT:1><EOL>if max_points is not None:<EOL><INDENT>if max_points <= <NUM_LIT:0>:<EOL><INDENT>raise ParameterError('<STR_LIT>')<EOL><DEDENT>if max_points < y.shape[-<NUM_LIT:1>]:<EOL><INDENT>target_sr = min(max_sr, (sr * y.shape[-<NUM_LIT:1>]) // max_points)<EOL><DEDENT>hop_length = sr // target_sr<EOL>if y.ndim == <NUM_LIT:1>:<EOL><INDENT>y = __envelope(y, hop_length)<EOL><DEDENT>else:<EOL><INDENT>y = np.vstack([__envelope(_, hop_length) for _ in y])<EOL><DEDENT><DEDENT>if y.ndim > <NUM_LIT:1>:<EOL><INDENT>y_top = y[<NUM_LIT:0>]<EOL>y_bottom = -y[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>y_top = y<EOL>y_bottom = -y<EOL><DEDENT>axes = __check_axes(ax)<EOL>kwargs.setdefault('<STR_LIT>', next(axes._get_lines.prop_cycler)['<STR_LIT>'])<EOL>locs = offset + core.frames_to_time(np.arange(len(y_top)),<EOL>sr=sr,<EOL>hop_length=hop_length)<EOL>out = axes.fill_between(locs, y_bottom, y_top, **kwargs)<EOL>axes.set_xlim([locs.min(), locs.max()])<EOL>if x_axis == '<STR_LIT:time>':<EOL><INDENT>axes.xaxis.set_major_formatter(TimeFormatter(lag=False))<EOL>axes.xaxis.set_label_text('<STR_LIT>')<EOL><DEDENT>elif x_axis is None or x_axis in ['<STR_LIT>', '<STR_LIT:none>']:<EOL><INDENT>axes.set_xticks([])<EOL><DEDENT>else:<EOL><INDENT>raise ParameterError('<STR_LIT>'.format(x_axis))<EOL><DEDENT>return out<EOL>
Plot the amplitude envelope of a waveform.

    If `y` is monophonic, a filled curve is drawn between `[-abs(y), abs(y)]`.

    If `y` is stereo, the curve is drawn between `[-abs(y[1]), abs(y[0])]`,
    so that the left and right channels are drawn above and below the axis,
    respectively.

    Long signals (`duration >= max_points`) are down-sampled to at
    most `max_sr` before plotting.

    Parameters
    ----------
    y : np.ndarray [shape=(n,) or (2,n)]
        audio time series (mono or stereo)

    sr : number > 0 [scalar]
        sampling rate of `y`

    max_points : postive number or None
        Maximum number of time-points to plot: if `max_points` exceeds
        the duration of `y`, then `y` is downsampled.

        If `None`, no downsampling is performed.

    x_axis : str {'time', 'off', 'none'} or None
        If 'time', the x-axis is given time tick-marks.

    ax : matplotlib.axes.Axes or None
        Axes to plot on instead of the default `plt.gca()`.

    offset : float
        Horizontal offset (in seconds) to start the waveform plot

    max_sr : number > 0 [scalar]
        Maximum sampling rate for the visualization

    kwargs
        Additional keyword arguments to `matplotlib.pyplot.fill_between`

    Returns
    -------
    pc : matplotlib.collections.PolyCollection
        The PolyCollection created by `fill_between`.

    See also
    --------
    librosa.core.resample
    matplotlib.pyplot.fill_between


    Examples
    --------
    Plot a monophonic waveform

    >>> import matplotlib.pyplot as plt
    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=10)
    >>> plt.figure()
    >>> plt.subplot(3, 1, 1)
    >>> librosa.display.waveplot(y, sr=sr)
    >>> plt.title('Monophonic')

    Or a stereo waveform

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      mono=False, duration=10)
    >>> plt.subplot(3, 1, 2)
    >>> librosa.display.waveplot(y, sr=sr)
    >>> plt.title('Stereo')

    Or harmonic and percussive components with transparency

    >>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=10)
    >>> y_harm, y_perc = librosa.effects.hpss(y)
    >>> plt.subplot(3, 1, 3)
    >>> librosa.display.waveplot(y_harm, sr=sr, alpha=0.25)
    >>> librosa.display.waveplot(y_perc, sr=sr, color='r', alpha=0.5)
    >>> plt.title('Harmonic + Percussive')
    >>> plt.tight_layout()