plotPowerSpectrum

maelzel.snd.plotting.plotPowerSpectrum(samples, samplerate, framesize=2048, window=('kaiser', 9), axes=None, figsize=(24, 4))[source]

Plot the power spectrum of a sound

Parameters:
  • samples (np.ndarray) – the samples to plot

  • samplerate (int) – the sr of thesamples

  • framesize – the bigger the frame size, the smoother the plot

  • window (str | tuple[str, float]) – As passed to scipy.signal.get_window. One of “blackman”, “hamming”, “hann”, “bartlett”, “flattop”, “parzen”, “bohman”, “blackmanharris”, “nuttall”, “barthann”, “kaiser” (needs beta), “gaussian” (needs standard deviation)

  • axes (Axes | None) – the axes to plot to

  • figsize – figure size of the plot

Return type:

Axes

Returns:

the axes used