mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-19 15:40:41 +00:00
Enhance plot script.
This commit is contained in:
parent
2ba760a1c1
commit
20699e30dd
@ -10,7 +10,7 @@ if __name__ == '__main__':
|
|||||||
# print(sd.query_devices())
|
# print(sd.query_devices())
|
||||||
|
|
||||||
fs = 48000 # Sample rate
|
fs = 48000 # Sample rate
|
||||||
duration = 100e-3 # Duration of recording
|
duration = 20e-3 # Duration of recording
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
# WDM-KS is needed since there are more than one MicNode device APIs (at least in Windows)
|
# WDM-KS is needed since there are more than one MicNode device APIs (at least in Windows)
|
||||||
@ -25,9 +25,14 @@ if __name__ == '__main__':
|
|||||||
sd.wait() # Wait until recording is finished
|
sd.wait() # Wait until recording is finished
|
||||||
print('Done!')
|
print('Done!')
|
||||||
|
|
||||||
|
|
||||||
time = np.arange(0, duration, 1 / fs) # time vector
|
time = np.arange(0, duration, 1 / fs) # time vector
|
||||||
|
# strip starting zero
|
||||||
|
myrecording = myrecording[100:]
|
||||||
|
time = time[100:]
|
||||||
plt.plot(time, myrecording)
|
plt.plot(time, myrecording)
|
||||||
plt.xlabel('Time [s]')
|
plt.xlabel('Time [s]')
|
||||||
plt.ylabel('Amplitude')
|
plt.ylabel('Amplitude')
|
||||||
plt.title('MicNode 4 Channel')
|
plt.title('MicNode 4 Channel')
|
||||||
|
plt.legend(['CH-1', 'CH-2', 'CH-3','CH-4'])
|
||||||
plt.show()
|
plt.show()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user