简体   繁体   中英

How to plot a Spectrogram of an audio file using Third Octave (1/3) Band central frequency instead of default narrow band in python?

import matplotlib.pyplot as plot
from scipy.io import wavfile
samplingFrequency, signalData = wavfile.read('someaudiofile.wav')
plot.specgram(signalData,cmap=plot.cm.rainbow_r, Fs=samplingFrequency)
plot.xlabel('Time')
plot.ylabel('Frequency')

Here plot.specgram is using narrow band to plot the Spectrogram, instead of that i want to use 1/3(third) octave band to plot spectrogram. I am not aware which of the parameter of this plot.specgram function I have to change.

Is there any other python library or any other method through which I can plot Spectrogram using 1/3 octave band using two input ( signaldata/Sample and sampling frequency)?

The Python package python-acoustics has implementations of 1/3 octave bands according to IEC 61260-1.

For plotting you can use acoustics.Signal.plot_third_octaves .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM