Skip to content

Commit

Permalink
Timbre
Browse files Browse the repository at this point in the history
  • Loading branch information
aishoot authored Jan 9, 2018
1 parent d73e47d commit cbd4851
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Timbre/SpectrogramTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import wave
import numpy as np
import matplotlib.pyplot as plt

fw = wave.open('../sounds/aeiou.wav','r')
print(fw.getparams())
soundInfo = fw.readframes(-1)
soundInfo = np.fromstring(soundInfo, np.int16)
f = fw.getframerate()
fw.close()

plt.subplot(211)
plt.plot(soundInfo)
plt.ylabel('Amplitude')
plt.title('Wave and spectrogram of aeiou.wav')

plt.subplot(212)
plt.specgram(soundInfo, Fs=f)
plt.ylabel('Frequency')
plt.xlabel('time(seconds)')
plt.savefig("spectrogram.png")
plt.show()
Binary file added Timbre/spectrogram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbd4851

Please sign in to comment.