Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

text to speech

import pyttsx3
engine = pyttsx3.init()
engine.say("")
engine.runAndWait()
Comment

speech to 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")
Comment

PREVIOUS NEXT
Code Example
Python :: foreign key django createview 
Python :: check whether number is even or odd 
Python :: pandas select multiple columns 
Python :: insert a new row to numpy array in especific position 
Python :: create an array filled with 0 
Python :: pandas.core.indexes into list 
Python :: search mean in python using pandas 
Python :: .size pandas 
Python :: how to make a static variable in python 
Python :: size pilimage 
Python :: node 14 alpine add python 
Python :: concate the dataframe in pandas.. 
Python :: how to take first half of list python 
Python :: list to one hot encoding pandas 
Python :: how to set environment variable in pycharm 
Python :: função anonima python 
Python :: importing python modules from a folder 
Python :: django-tool-bar 
Python :: python pytest no coverage on failure 
Python :: Reversing Ints 
Python :: ipython play audio 
Python :: python cassandra 
Python :: python remove white space 
Python :: how to delete item in string python 
Python :: loading a webpage with aiohttp 
Python :: Concatenating objects in pandas 
Python :: python run things at certain datetimes 
Python :: django insert bulk data 
Python :: views.py 
Python :: python load file with multiple jsons 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =