Blog‎ > ‎

Spectrogram in Python

posted Mar 4, 2018, 5:56 AM by MUHAMMAD MUN`IM AHMAD ZABIDI
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import scipy
import matplotlib.pyplot as plt
import scipy.io.wavfile

sample_rate, X = scipy.io.wavfile.read('audio.wav')
print (sample_rate, X.shape )
plt.specgram(X, Fs=sample_rate, xextent=(0,30))
Comments