-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdct2.py
27 lines (21 loc) · 795 Bytes
/
dct2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
def pretty_spectrogram(specgram, thresh=0, start_frame=0, end_frame=-1):
specgram[specgram < 0] = 0
if end_frame == -1:
end_frame = len(specgram)
if end_frame > len(specgram):
end_frame = len(specgram)
if start_frame > len(specgram):
start_frame = 0
specgram = specgram[start_frame:end_frame, :]
return specgram
target = np.load("/Users/ashisharora/fbank_feats/reverb1-011c0201.npy")
target = pretty_spectrogram(target)
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(20, 4))
cax = ax.matshow(np.transpose(target), interpolation='nearest', aspect='auto', origin='lower')
fig.colorbar(cax)
plt.title('reverb1-011c0201')
fig.savefig('plot2d1.png')