s0d3s / PyAudioWPatch

šŸ PyAudio | PortAudio fork with WASAPI loopback support šŸ”Š Record audio from speakers on Windows
Other
128 stars 7 forks source link

Is there any way to use SpeechRecognition with wasapi loopback? #21

Open imposterfromtheamongus opened 1 month ago

imposterfromtheamongus commented 1 month ago

What problem are you facing?

What is the cause of the error (in your opinion)?

ā— Before creating, complete the checklist:

If the problem is related to the inability to record sound from speakers, then before creating this issue, try to first record audio using the provided examples (for example, simple_recording_app.py)

Start your issue here šŸ‘‡

Is there any way to use SpeechRecognition with wasapi? like this ` import pyaudiowpatch as pyaudio import speech_recognition as sr

p = pyaudio.Pyaudio() recognizer = sr.Recognizer()

default_speakers = p.get_default_wasapi_loopback()

rate = int(default_speakers["defaultSampleRate"]) channels = default_speakers["maxInputChannels"] print(f"Recording from: ({default_speakers['index']}) {rate} {channels} {default_speakers['name']}")

stream = p.open( format=data_format, channels=channels, rate=rate, frames_per_buffer=1024, input=True, input_device_index=default_speakers["index"], )

recognizer.listen_in_background(stream.read(4096)) # i tried but doesnt work

` any help would be appreciated!

imposterfromtheamongus commented 1 month ago

(in real time)