plotSpectrogram¶
- maelzel.snd.plotting.plotSpectrogram(samples, sr, fftsize=2048, window='hamming', winsize=None, overlap=4, axes=None, cmap='inferno', interpolation='bilinear', minfreq=40, maxfreq=16000, mindb=-90, axeslabels=False, figsize=(24, 8), method='specgram', yaxis='linear')[source]¶
Plot the spectrogram of a sound
- Parameters:
samples (
ndarray
) – a channel of audio datasr (
int
) – sr of the audio datafftsize – size of the fft, in samples
winsize (
Optional
[int
]) – size of the window, in sampleswindow (
str
) – string passed to scipy.signal.get_windowoverlap – number of overlaps. If fftsize=2048, an overlap of 4 will result in a hoplength of 512 samples. Use None to use a sensible value for the number of samples.
axes (
Optional
[Axes
]) – axes to plot on. If None, new axes will be createdcmap – colormap (see pyplot.colormaps())
minfreq – initial min. frequency
maxfreq – initial max. frequency. If None, a configurable default will be used
interpolation – one of ‘bilinear’
mindb – the amplitude threshold
figsize – if axes is not given, use this size to determine the figure size. The value should be a tuplet (width, height)
yaxis – one of ‘linear’, ‘log’
method – the actual routine to plot the data, one of ‘specgram’, ‘specshow’ (based on librosa)
- Return type:
Axes
- Returns:
the matplotlib axes object