“Rede zum Text” Code-Antworten

Text zu Sprache

# Import the required module for text
# to speech conversion
from gtts import gTTS

# This module is imported so that we can
# play the converted audio

mytext = input("Enter the text to be converted: ")

language = 'en'



myobj = gTTS(text=mytext, lang=language, slow=False)

E = input("Enter the name of the file: ")

myobj.save(E + ".mp3")
#you can change mp3 to wav
cool dude

Rede zum Text

import speech_recognition as sr
import pyttsx3

engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices[1].id)
engine.setProperty('voice', voices[0].id)


def speak(audio):
    engine.say(audio)
    engine.runAndWait()

r = sr.Recognizer()

with sr.Microphone() as source:
    print("Speak anything")
    speak("Speak anything")
    audio = r.listen(source)

try:
    text = r.recognize_google(audio)
    print("you said : {}".format(text))
    speak("you said : {}".format(text))

except:
 print("Sorry could not recognize your voice")
 speak("Sorry could not recognize your voice")
Coding boy Hasya

Rede zum Text

<html>

</html>
Adventa Project

Ähnliche Antworten wie “Rede zum Text”

Fragen ähnlich wie “Rede zum Text”

Weitere verwandte Antworten zu “Rede zum Text” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen