I'm recording a numpy array dt and then writing it in .wav by code like this:
dt = np.int16(dt/np.max(np.abs(dt)) * 32767)
scipy.io.wavfile.write("tmp.wav", samplerate, dt)
after that I read it and recognize by code
import speech_recognition as sr
r = sr.Recognizer()
with sr.AudioFile("tmp.wav") as source:
audio_text = r.listen(source)
return r.recognize_google(audio_text, language = lang)
Can I do recognition from numpy array without using wav? Cuz it takes excess time