Answers for "convert audio to text python"

1

python speech to text

import speech_recognition as sr


        def main():

            r = sr.Recognizer()

            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source)

                audio = r.listen(source)

                try:

                    print(r.recognize_google(audio))

                except Exception as e:
                    print("Error :  " + str(e))


                with open("recorded.wav", "wb") as f:
                    f.write(audio.get_wav_data())


        if __name__ == "__main__":
            main()
Posted by: Guest on October-04-2020
0

python library to convert text to audio

import pyttsx3.
# initialize Text-to-speech engine.
engine = pyttsx3.init()
# convert this text to speech.
text = "Python is a great programming language"
engine.say(text)
# play the speech.
engine.runAndWait()
Posted by: Guest on October-07-2021

Code answers related to "convert audio to text python"

Python Answers by Framework

Browse Popular Code Answers by Language