Python 3 speech recognition (speech to text)

Python 3 speech recognition (speech to text)

Published at - Aug 13, 2021

Speech Recognition is an important feature in several applications used such as home automation, artificial intelligence, etc. This article aims to provide an introduction on how to make use of the SpeechRecognition and pyttsx3 library of Python.

For speech recognition we need to install SpeechRecognition package via PIP

pip install SpeechRecognition

After installing the package we need to copy and paste following code an run our program

import speech_recognition as sr
# importing pachage
# checking for microphone
with sr.Microphone() as source:
    # r.energy_threshold()
    print("say anything : ")
    audio= r.listen(source)
        text = r.recognize_google(audio)
        print("sorry, could not recognise")

Enjoy coding

Buy me a coffee

Follow Us

Follow us on facebook Click Here

Facebook QR
Scan from mobile
Join our telegram channel Click Here
Telegram QR
Scan from mobile