plotWaveform¶
- maelzel.snd.plotting.plotWaveform(samples, samplerate, profile='', saveas='', timelabels=True, figsize=(24, 4))[source]¶
Plot the waveform of a sound using pyplot
- Parameters:
samples – a mono or multichannel audio array
samplerate (
int
) – the srprofile – one of ‘low’, ‘medium’, ‘high’, ‘highest’. If not given a preset is chosen based on the duration and other parameters given
saveas – if given, the plot is saved and not displayed
timelabels – if True, the x axes’ labels are shown as MM:SS if needed
figsize – the figsize used
- Return type:
list
[Axes
]- Returns:
the axes used (one per channel)
Example
>>> from maelzel.snd import plotting >>> import sndfileio >>> samples, info = sndfileio.sndget("snd/bach-presto-gmoll.mp3") # In this case the preset used will be 'high' >>> plotting.plotWaveform(samples, info.sr)
>>> plotting.plotWaveform(samples, info.sr, preset='low')
>>> plotting.plotWaveform(samples, info.sr, preset='medium')
>>> plotting.plotWaveform(samples, info.sr, preset='high')
>>> plotting.plotWaveform(samples, info.sr, preset='highest')