Speech Recognition | Python Program

 Speech recognition:

Tips:  

1.Open your terminal or command prompt type "pip install speechRecognition".
2.Check your internet connection.
3.Save a .wav extension recorded audio file name as "sound" in my document.
4.Then, type under below code.

Code:

import speech_recognition as sr

AUDIO_FILE=('sound.wav')

r=sr.Recognizer()

with sr.AudioFile(AUDIO_FILE) as source:

    audio=r.record(source)

try:
    print("audio file contain:\n"+r.recognize_google(audio))

except sr.UnknownValueError:

    print("Not recog")

except sr.RequestError:

    print("Data not get")


---------------------------------------------------------------------------------------------------------------------------
Thank you for visiting. Comment for response! 
 

Comments

  1. I am using ubuntu 18.04 and i don't have 'my document' folder as like windows, then where should i keep my audio file..??

    ReplyDelete
    Replies
    1. For Ubuntu:

      In second line of code

      rewrite:

      AUDIO_FILE=('C:\Users\"name of your computer"\Desktop\sound.wav')

      or

      AUDIO_FILE=('/home/"name of your computer"/Desktop/sound.wav')


      Delete
    2. I don't have a home folder too. Although i understood what you are trying to say. Thank you.

      Delete
  2. 1. Open one terminal and type "cd /" , you will be in system directory. From there navigate to the folder in which you have your audio file and that will be exact path which you gona be using in the program.

    2. You can also try be keep the audio file in the same folder in which you kept your program (example.py) file.

    Hope this helps.

    ReplyDelete

Post a Comment

Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :