Skip to content

vinayparjapati5/Speech-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Introduction

Speech recognition is a machine's ability to listen to spoken words and identify them. You can then use speech recognition in Python to convert the spoken words into text, make a query or give a reply. You can even program some devices to respond to these spoken words. You can do speech recognition in python with the help of computer programs that take in input from the microphone, process it, and convert it into a suitable form.

image

Pre-requisites

For microphone use

  1. Check for pyaudio:
>>> import pyaudio as pa
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyaudio
>>>
  1. Install pyaudio
$ pip install --user pyaudio

For Speech Recognition

  1. Check for SpeechRecognition:
$ pip list --format=freeze | grep SpeechRecognition
  1. Install SpeechRecognition
$ pip install --user SpeechRecognition

Code

import speech_recognition as sr

def main(): r= sr.Recognizer() with sr.Microphone() as source:

    print("Listening...")
    r.pause_threshold=0.6

    audio = r.listen(source)

    try:
        ask = r.recognize_google(audio, language='en-us')
        print(f"Converted Audio is: {ask}" )

    except Exception:
            print("say that again")
            return ""

return ask

main()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages