Home Read mp3 file saved from gtts into speech recognizer
Reply: 0

Read mp3 file saved from gtts into speech recognizer

learner
1#
learner Published in 2018-02-13 20:27:14Z

I am trying to write into mp3 file. Then I read the same mp3 and try to transcribe it into text. I keep on getting the following error.

from gtts import gTTS
text = ("Spoken text")
tts = gTTS(text=text, lang='en')
tts.save("test.mp3")
import speech_recognition as sr
AUDIO_FILE = "test.mp3"
# use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
    audio = r.record(source)  # read the entire audio file




ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302377 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO