summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2023-10-10 18:25:14 +0200
committerHiFiPhile <[email protected]>2023-10-10 18:25:14 +0200
commit20699e30dd7847a7177d91dc76791248a788f3dc (patch)
tree38cf223c24cb919df23f0a5927f6a6221dd7e069 /examples/device
parent2ba760a1c16dc096da9f96f20cf2443e3a1d8416 (diff)
Enhance plot script.
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/audio_4_channel_mic/src/plot_audio_samples.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/device/audio_4_channel_mic/src/plot_audio_samples.py b/examples/device/audio_4_channel_mic/src/plot_audio_samples.py
index 8312b4e28..a3a2b2fd4 100644
--- a/examples/device/audio_4_channel_mic/src/plot_audio_samples.py
+++ b/examples/device/audio_4_channel_mic/src/plot_audio_samples.py
@@ -10,7 +10,7 @@ if __name__ == '__main__':
# print(sd.query_devices())
fs = 48000 # Sample rate
- duration = 100e-3 # Duration of recording
+ duration = 20e-3 # Duration of recording
if platform.system() == '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
print('Done!')
+
time = np.arange(0, duration, 1 / fs) # time vector
+ # strip starting zero
+ myrecording = myrecording[100:]
+ time = time[100:]
plt.plot(time, myrecording)
plt.xlabel('Time [s]')
plt.ylabel('Amplitude')
plt.title('MicNode 4 Channel')
+ plt.legend(['CH-1', 'CH-2', 'CH-3','CH-4'])
plt.show()