diff options
| author | Reinhard Panhuber <[email protected]> | 2021-04-08 19:56:26 +0200 |
|---|---|---|
| committer | Reinhard Panhuber <[email protected]> | 2021-04-08 19:56:26 +0200 |
| commit | 930eca0748f047c0130bcf28039c34a1d489b89e (patch) | |
| tree | 229e0ed6e97551123797914f8c575e7ae778269d /examples/device/audio_4_channel_mic/src/plot_audio_samples.py | |
| parent | 8eacdffebdcc10a6fffdc248ef6086b223f3edf3 (diff) | |
Add 4 channel microphone audio example using software encoding
Diffstat (limited to 'examples/device/audio_4_channel_mic/src/plot_audio_samples.py')
| -rw-r--r-- | examples/device/audio_4_channel_mic/src/plot_audio_samples.py | 26 |
1 files changed, 26 insertions, 0 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 new file mode 100644 index 000000000..0bd6f3b5d --- /dev/null +++ b/examples/device/audio_4_channel_mic/src/plot_audio_samples.py @@ -0,0 +1,26 @@ +import sounddevice as sd +import matplotlib.pyplot as plt +import numpy as np + +if __name__ == '__main__': + + # Currently tested for Windows - on Linux try to find the device or use default device if not clearly listed + # devList = sd.query_devices() + # print(devList) + + fs = 48000 # Sample rate + duration = 100e-3 # Duration of recording + device = 'Microphone (MicNode_4_Ch), Windows WDM-KS' # WDM-KS is needed since there are more than one MicNode device APIs (at least in Windows) + + myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=4, dtype='int16', device=device) + print('Waiting...') + sd.wait() # Wait until recording is finished + print('Done!') + + time = np.arange(0, duration, 1 / fs) # time vector + plt.plot(time, myrecording) + plt.xlabel('Time [s]') + plt.ylabel('Amplitude') + plt.title('MicNode 4 Channel') + plt.show() +
\ No newline at end of file |
