#๐ did they remove recognize_google from speech_recognition?
50 messages ยท Page 1 of 1 (latest)
@smoky solar
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
it's still there as far as i can see.
Ok it just doesnt recognise it
Let me take a screenshot
Ignore the audio bit
i just typed it up quickly so audio doesnt exist
but see how its not recognised
whereas vosk is
@whole sequoia
the editor might not recognize it, but it works.
import speech_recognition as sr
# obtain path to "english.wav" in the same folder as this script
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav")
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
# recognize speech using Google Speech Recognition
try:
print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
@whole sequoia how would i put that into a text file tho
instead of the audio
so using PyAudio
you would not use a text file.
it doesn't work that way
you just need an audio file
and the example for that is above.
did you read the message?
right so?
so it still didnt work
because you're not passing it an audio file.
does it play?
Theres no audio in it
I fixed it
The script doesnt record what im saying though
Surley something like this would work
import speech_recognition as sr
import pyttsx3
recogniser = sr.Recognizer()
while True:
try:
with sr.Microphone() as mic:
recogniser.adjust_for_ambient_noise(mic, duration=0.2)
audio = recogniser.listen(mic)
text = recogniser.recognize_google(audio)
text = text.lower()
print(f"recognised {text}")
except sr.UnknownValueError():
recogniser = sr.Recognizer()
continue
Hey @smoky solar!
It looks like you're trying to paste code into this channel.
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
import speech_recognition as sr
import pyttsx3
recogniser = sr.Recognizer()
while True:
try:
with sr.Microphone() as mic:
recogniser.adjust_for_ambient_noise(mic, duration=0.2)
audio = recogniser.listen(mic)
text = recogniser.recognize_google(audio)
text = text.lower()
print(f"recognised {text}")
except sr.UnknownValueError():
recogniser = sr.Recognizer()
continue
i got it working
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.