“Discours au texte” Réponses codées

texte pour parler

# 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

discours au texte

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

Discours au texte

<html>

</html>
Adventa Project

Réponses similaires à “Discours au texte”

Questions similaires à “Discours au texte”

Plus de réponses similaires à “Discours au texte” dans HTML

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code