mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 13:20:54 +00:00
update plot script to work on macos and linux
also add note for installing pip module
This commit is contained in:
parent
8d9f60ca5e
commit
ad11481dd1
@ -23,6 +23,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* plot_audio_samples.py requires following modules:
|
||||
* $ sudo apt install libportaudio
|
||||
* $ pip3 install sounddevice matplotlib
|
||||
*
|
||||
* Then run
|
||||
* $ python3 plot_audio_samples.py
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -1,16 +1,24 @@
|
||||
import sounddevice as sd
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import platform
|
||||
|
||||
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)
|
||||
# If you got "ValueError: No input device matching", that is because your PC name example device
|
||||
# differently from tested list below. Uncomment the next line to see full list and try to pick correct one
|
||||
# print(sd.query_devices())
|
||||
|
||||
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)
|
||||
fs = 48000 # Sample rate
|
||||
duration = 100e-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)
|
||||
device = 'Microphone (MicNode_4_Ch), Windows WDM-KS'
|
||||
elif platform.system() == 'Darwin':
|
||||
device = 'MicNode_4_Ch'
|
||||
else:
|
||||
device ='default'
|
||||
|
||||
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=4, dtype='int16', device=device)
|
||||
print('Waiting...')
|
||||
|
@ -23,6 +23,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* plot_audio_samples.py requires following modules:
|
||||
* $ sudo apt install libportaudio
|
||||
* $ pip3 install sounddevice matplotlib
|
||||
*
|
||||
* Then run
|
||||
* $ python3 plot_audio_samples.py
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -1,15 +1,24 @@
|
||||
import sounddevice as sd
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import platform
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
# devList = sd.query_devices()
|
||||
# print(devList)
|
||||
# If you got "ValueError: No input device matching", that is because your PC name example device
|
||||
# differently from tested list below. Uncomment the next line to see full list and try to pick correct one
|
||||
# print(sd.query_devices())
|
||||
|
||||
fs = 48000 # Sample rate
|
||||
duration = 100e-3 # Duration of recording
|
||||
device = 'Microphone (MicNode) MME' # MME is needed since there are more than one MicNode device APIs (at least in Windows)
|
||||
fs = 48000 # Sample rate
|
||||
duration = 100e-3 # Duration of recording
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
# MME is needed since there are more than one MicNode device APIs (at least in Windows)
|
||||
device = 'Microphone (MicNode) MME'
|
||||
elif platform.system() == 'Darwin':
|
||||
device = 'MicNode'
|
||||
else:
|
||||
device ='default'
|
||||
|
||||
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=1, dtype='int16', device=device)
|
||||
print('Waiting...')
|
||||
|
Loading…
x
Reference in New Issue
Block a user