PYTHON | SPEECH TO TEXT| text to voice assistant | pyttsx3 | pyaudio | English tutorial

Опубликовано: 18 Май 2026
на канале: Karan TechBlaze
2,230
34

DREAM OF HAVING YOUR OWN DIGITAL ASSISTANT ?
HERE I AM GOING TO GIVE YOU TASTE OF IT
ADD YOUR CREATIVITY TO IT FOR YOUR COOL ASSISTANT
USING PYTHON

github link for code:
https://github.com/Jindalkaran/assist...

link for downloading pyaudio:
https://www.lfd.uci.edu/~gohlke/pytho...


Also watch more such videos:
Web development:    • Web Development Complete Guide | web hosti...  
Blocking Website:    • PREVENT ANYONE FROM VISITING WEBSITE | How...  
cool trick voice greeting :    • Voice Greeting from your Computer On start...  
and many more....on my channel

Please Subscribe:
   / karanagarwalblaze  


CODE(please mark indentation or download from link):

#code for youtube video on assistant


import pyttsx3
import speech_recognition as sr


#code for text to speech using microsoft inbuilt api sapi5

engine=pyttsx3.init('sapi5')
voices_in_our_pc=engine.getProperty('voices')
print(voices_in_our_pc)
#setting a voice for our use
engine.setProperty('voice',voices_in_our_pc[0].id)
#speak function
def speak(text):
engine.say(text)
print('Computer :'+text)
engine.runAndWait()

speak('Hello everyone !!')


#code for speech to text convertion
def speech():
r=sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold=1
audio=r.listen(source)

try:
speech=r.recognize_google(audio,language='en-in')
except sr.UnknownValueError:
speak('Sorry')
speech='None'
return speech

print('Speeck: '+speech())