import sounddevice as sd
from scipy.io.wavfile import write
duration = 10.5 # seconds
try:
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=1) # 2 did not work, but 1 works.
sd.wait() # Wait until recording is finished
write('output.wav', fs, myrecording) # Save as WAV file
except:
pass
No comments:
Post a Comment