I have been working on a project which includes the use of Windows WASAPI. Which enables python scripts to record the system audio on a device. I'm using soundcard python library to record the system audio which returns with an array. After creating an AudioData object it returns with unable to recognise speech. Even with the clearest recording of for eg. podcasts. please find the relevant code below:
import speech_recognition as sr
import numpy as np
import soundcard as sc
mics = sc.all_microphones(include_loopback=True)
def_mic = mics[0]
data = def_mic.record(samplerate=48000, numframes=480000,channels=1)
recognizer = sr.Recognizer()
audio = sr.AudioData(data,48000,1)
response["transcription"] = recognizer.recognize_google(audio)
I have been working on a project which includes the use of Windows WASAPI. Which enables python scripts to record the system audio on a device. I'm using soundcard python library to record the system audio which returns with an array. After creating an AudioData object it returns with unable to recognise speech. Even with the clearest recording of for eg. podcasts. please find the relevant code below: