Skip to content

Instantly share code, notes, and snippets.

@ProjectEli
Created May 5, 2021 17:31
Show Gist options
  • Save ProjectEli/373a637de81dface0fe204cf0cc7ae11 to your computer and use it in GitHub Desktop.
Save ProjectEli/373a637de81dface0fe204cf0cc7ae11 to your computer and use it in GitHub Desktop.
Record voice and save to wav file (PCM)
import speech_recognition
with speech_recognition.Microphone() as src:
audio = speech_recognition.Recognizer().listen(src)
print("Listening...")
with open('recordedaudio.wav','wb') as f:
f.write(audio.get_wav_data())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment