Giter Club home page Giter Club logo

python-speech-recognition's Introduction

Speech Recognition with Python

This repository contains resources from The Ultimate Guide to Speech Recognition with Python tutorial on Real Python.

Audio files for the examples in the Working With Audio Files section of the post can be found in the audio_files directory. To download them, use the green "Clone or download" button at the top right corner of this page.

The guessing_game.py file contains the full source code for the "Guess a Word" game example.

NOTE: You will need to install the SpeechRecognition and PyAudio packages in order to run the example. Please see the tutorial for step-by-step instructions.

You can test your SpeechRecognition and PyAudio installation by downloading guessing_game.py and typing the following into a Python REPL session:

>>> import speech_recognition as sr
>>> from guessing_game.py import recognize_speech_from_mic
>>> r = sr.Recognizer()
>>> m = sr.Microphone()
>>> recognize_speech_from_mic(r, m)  # speak after running this line
{'success': True, 'error': None, 'transcription': 'hello'}

Of course, your output will vary depending on what you said after running recognize_speech_from_mic(r, m).

python-speech-recognition's People

Contributors

dbader avatar somacdivad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-speech-recognition's Issues

Alternative for Google Web Speech API

"Caution: The default key provided by SpeechRecognition is for testing purposes only, and Google may revoke it at any time. It is not a good idea to use the Google Web Speech API in production. Even with a valid API key, you’ll be limited to only 50 requests per day, and there is no way to raise this quota. Fortunately, SpeechRecognition’s interface is nearly identical for each API, so what you learn today will be easy to translate to a real-world project."

Sir, since the Google Web Speech API cannot be used in production, what is the alternative for it? I mean how can I use the speech recognition then?

Facing Problem in Executing Rock , papers , scissors game . need help in python

`
'''This code is not giving error but i dont know why the "comp" value is always none. its not changing even through random module and its functions . please help me
'''
import random

def game(comp , player):
if player == comp:
return None
elif comp == "r":
if player == "s":
return False
elif player == "p":
return True
elif comp == "s":
if player == "p":
return False
elif player == "r":
return True
elif comp == "p":
if player == "r":
return False
elif player == "s":
return True

comp = print("Comp Turn: Rock , Papers, Scissors: ")
randNo = random.randint(1 , 3)
if randNo == 1:
comp == "r"
elif randNo == 2:
comp == "p"
elif randNo == 3:
comp == "s"

player = input("Your Turn: Rock(r) , Papers(p) , Scissors(s) : ")

result = game( comp , player)

print("Computer chose" , comp)
print("You chose`" , player)

if result == None:
print("The game is tied")
elif result:
print("You Won")
else:
print("You Lose")

'''
the "comp" value is showing none type, i want it to be str. i tried converting it but it not worked plzzz help masters. anyone professional here to help`'''

speech file can't be longer than 30 seconds

hi

i modifed your code a bit to read from sample file. My sample file is 55 seconds long and I noticed that it get's cut off.

I am using recognize_google.

I am guessing this is some sort of api limitation and that I should probably get my own key.

changing the key fails

I got a new GCP API key, and I tried to use it but I keep getting broken connection:

Traceback (most recent call last): File "main.py", line 13, in <module> speech=r.recognize_google(audio,key='A...........8g') File "/home/davy/anaconda3/lib/python3.6/site-packages/speech_recognition/__init__.py", line 845, in recognize_google raise RequestError("recognition connection failed: {}".format(e.reason)) speech_recognition.RequestError: recognition connection failed: [Errno 32] Broken pipe
I don't really understand why that is. I noticed that in the init.py file the key is set as follows:

if key is None: key = "AIz...bla...bla..bla...gw" url = "http://www.google.com/speech-api/v2/recognize?{}".format(urlencode({ "client": "chromium", "lang": language, "key": key, }))

Do i need to change the client? but it is just an API key client shouldn't matter right?

unable to play .wav files on MS Windows

I am unable to open these .wav files on multiple PCs, trying multiple Music players, e.g. VLC Media Player, Groove Music, Windows Media Player, ITunes, and following your speech recognition article for python.
Can you provide files that can be used on MS Windows out of the box?
Here is the Groove Music error message:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.