maad.util.plot_wave
- maad.util.plot_wave(s, fs, tlims=None, ax=None, **kwargs)[source]
Plot audio waveform.
- Parameters:
- s1d ndarray
Audio signal.
- fsint
Sampling rate of audio signal.
- tlimstuple, optional
Minimum and maximum temporal limits for the display (min_t, max_t). The default is None.
- axmatplotlib.axes, optional
Pre-existing axes for the plot. The default is None.
- **kwargsmatplotlib figure properties
Other keyword arguments that are passed down to matplotlib.axes.
- Returns:
- axmatplotlib.axes
The matplotlib axes associated to plot.
See also
maad.sound.plot_spectrum
Examples
Plot a waveform of an audio signal. >>> from maad import sound >>> from maad.util import plot_wave >>> s, fs = sound.load(‘../data/spinetail.wav’) >>> ax = plot_wave(s, fs)
Use plot_wave with predifined matplotlib axes. >>> import matplotlib.pyplot as plt >>> s, fs = sound.load(‘../data/spinetail.wav’) >>> fig, ax = plt.subplots(2,1) >>> plot_wave(s, fs, ax=ax[0], xlabel=’’, figtitle=’Spinetail’) >>> plot_wave(s, fs, tlims=(5,8), ax=ax[1])