Answers for "use sphinx instead of google speech to text"

0

use sphinx instead of google speech to text

import speech_recognition as sr
r = sr.Recognizer()
file = sr.AudioFile('FILE_NAME.wav')
# for audio transcription
with file as source:
    audio = r.record(source)
# recognize audio using Sphinx
try:
    recog = r.recognize_sphinx(audio)  
    print("Sphinx thinks you said '" + recog + "'")  
except sr.UnknownValueError:  
    print("Sphinx could not understand audio")  
except sr.RequestError as e:  
    print("Sphinx error; {0}".format(e))
Posted by: Guest on April-21-2022
0

use sphinx instead of google speech to text

import speech_recognition as sr

r = sr.Recognizer()
speech = sr.Microphone(device_index=0)
# for speech recognition
with speech as source:
    print("say something!…")
    audio = r.adjust_for_ambient_noise(source)
    audio = r.listen(source)
# recognize speech using Sphinx
try:
    recog = r.recognize_sphinx(audio)  
    print("Sphinx thinks you said '" + recog + "'")  
except sr.UnknownValueError:  
    print("Sphinx could not understand audio")  
except sr.RequestError as e:  
    print("Sphinx error; {0}".format(e))
Posted by: Guest on April-21-2022

Code answers related to "use sphinx instead of google speech to text"

Browse Popular Code Answers by Language