Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created October 31, 2021 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/77e1ee213ad850c3f02edaa4ff0023f5 to your computer and use it in GitHub Desktop.
Save amankharwal/77e1ee213ad850c3f02edaa4ff0023f5 to your computer and use it in GitHub Desktop.
import sounddevice
from scipy.io.wavfile import write
def voice_recorder(seconds, file):
print("Recording Started...")
recording = sounddevice.rec((seconds * 44100), samplerate= 44100, channels=2)
sounddevice.wait()
write(file, 44100, recording)
print("Recording Finished")
voice_recorder(10, "record.wav")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment