Speech Recognition using PyAudio and SpeechRecognition Libraries

This is simple program to convert audio into text. I have used speec_recognition library to do it.

import speech_recognition as sr

r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak Anything :")
    audio = r.listen(source)
    try:
        text = r.recognize_google(audio)
        print("You said : {}".format(text))
    except:
        print("Sorry could not recognize what you said")

Output-
Speak Anything : You said : internet is required to access the Google API if there is no internet you will not be able to convert voice into text


to install SpeechRecognition-
https://pypi.org/project/SpeechRecognition/

one of the dependencies is PyAudio which is not supported after 3.6.
For python verison 3.6+ one needs to download wheel ( https://python101.pythonlibrary.org/chapter39_wheels.html)  and install PyAudio separately.

https://stackoverflow.com/questions/54998028/how-do-i-install-pyaudio-on-python-3-7


Comments

Popular posts from this blog

Automatically open and do some actions on web pages in python using different packages

open multiple sites in python Script using web browser package