Created
December 16, 2014 17:06
-
-
Save 0atman/ec2acea90f6c0b56c1b6 to your computer and use it in GitHub Desktop.
A python script to do google speech API transcription
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Requires the pip package `SpeechRecognition` | |
The google api seems to only like 15s chuncks | |
""" | |
import speech_recognition as sr | |
import sys | |
r = sr.Recognizer() | |
with sr.WavFile(sys.argv[1]) as source: | |
audio = r.record(source) | |
try: | |
print(r.recognize(audio, True)[0]['text']) | |
except LookupError as lookup_error: | |
print(lookup_error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment