Advertisement
bacnguyenxgen

Record audio

Mar 12th, 2022 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import sounddevice
  2. from scipy.io.wavfile import write
  3. fs=44100
  4. second=int(input("Mời nhập thời gian ghi âm ")) #Nhập vào khoảng thời gian muốn ghi âm
  5. print("Đang ghi âm....\n")
  6. record_voice=sounddevice.rec(int(second * fs),samplerate=fs,channels=2)
  7. sounddevice.wait()
  8. write("out.wav",fs,record_voice)
  9. print("Thành công...\nHãy mở file ghi âm để kiểm tra...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement