Jul-12-2020, 07:02 PM
Thank you for the reply, don't worry, we have the code.
import math as mt import numpy as np import os import random as rd import winsound as ws import pyaudio as pa import speech_recognition as sr ### This has to be 3.6.5 (32-bit for pyaudio) for index, name in enumerate(sr.Microphone.list_microphone_names()): print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name)) # get audio from the microphone r = sr.Recognizer() with sr.Microphone() as source: print("Speak:") audio = r.listen(source) r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY") try: print("You said " + r.recognize_google(audio)) except sr.UnknownValueError: print("Could not understand audio") except sr.RequestError as e: print("Could not request results; {0}".format(e))