-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwavplot
More file actions
executable file
·31 lines (21 loc) · 809 Bytes
/
wavplot
File metadata and controls
executable file
·31 lines (21 loc) · 809 Bytes
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
28
29
30
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
import sys
import struct
from wavhelp import *
if __name__ == "__main__":
maxchannels = 0
for n, f in enumerate(sys.argv[1:]):
fig = plt.figure()
signal, framerate, channels, BitsPerSample = wav_read(f, True)
maxchannels = max(channels, maxchannels)
# before looping, create the ax object required by sharex, sharey
ax = fig.add_subplot(maxchannels, 1, 1)
for channel in range(channels):
ax = fig.add_subplot(maxchannels, 1, channel+1, sharex=ax, sharey=ax)
ax.plot(signal[channel::channels], label=sys.argv[1+n] + ', channel ' + str(channel))
plt.ylabel('Amplitude')
plt.xlabel('Sample')
plt.legend()
plt.show()