Skip to content

Instantly share code, notes, and snippets.

@Neptune998
Created September 19, 2020 11:01
Show Gist options
  • Save Neptune998/6c387e1d0b05a0b415d363c4fb95d29b to your computer and use it in GitHub Desktop.
Save Neptune998/6c387e1d0b05a0b415d363c4fb95d29b to your computer and use it in GitHub Desktop.
# Libraries import
import speech_recognition as sr
# It will read audio file
audio = sr.AudioFile("Converted_audio.wav")
print("Audio file readed...")
# Here the magic start
# create an instance of recognizer as r
r = sr.Recognizer()
with audio as source:
audio_file = r.record(source)
# Here we get our text
result = r.recognize_google(audio_file)
# Now we will store the text in file
with open('recognized.txt',mode ='w') as file:
file.write(result)
print("Wooh.. You did it...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment