Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. import sounddevice as sd
  2. import soundfile as sf
  3.  
  4. samplerate = 16000
  5. duration = 1 # seconds
  6. filename = 'yes.wav'
  7. print("start")
  8. mydata = sd.rec(int(samplerate * duration), samplerate=samplerate,
  9. channels=1, blocking=True)
  10. print("end")
  11. sd.wait()
  12. sf.write(filename, mydata, samplerate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement