0

I have a raspberry pi 3 and it is hosting a web server and want to send audio input to it from my laptop mic to the web server that it is hosting for some task to be accomplished. Problem is, it is expecting input from it's own microphone not my laptop's when I access the web server from my laptop's browser using the rpi3's ip address. How can I get it to use my laptop's mic? I am using the python speech_recognition package with google web speech api to transcribe the audio from speech to text and audio is activated with a POST button with the click of a button for the function responsible.

This is my code for now:

import speech_recognition as ak

    sp = ak.Recognizer()
with ak.Microphone() as source:
    print("Say something!")
    audio = sp.listen(source)

try:
    value = sp.recognize_google(audio)
except:
    pass

Thanks!

  • @TomasBy yeah it needs to read microphone as a live source – Aditya Raj Jun 16 '20 at 11:32
  • Reading mic live is hard. I heard that the Arduino guys are using PCM1802 24-bit HiFi stereo ADC to convert audio from mic to digital signal and then at the other side use CS4344 24 bit HiFi stero DAC to convert digital signal back to analog audio. Of course you can use your laptop to use PCM1802 to convert mic audio to digital and send the digital stuff through Ethernet to Rpi which can do anything it wants. Let me see if I can find the reference post. – tlfong01 Jun 16 '20 at 12:26
  • I found what the Arduino guys want to do it with Rpi, in the following Rpi SE Q&A: "How to use Rpi python to control PCM1802 24-bit HiFi stereo ADC and MAX4466 microphone amplifier": https://raspberrypi.stackexchange.com/questions/107778/how-to-use-rpi-python-to-control-pcm1802-24-bit-hifi-stereo-adc-and-max4466-micr%2044Aier. The project is for 24 bit HiFi stero. But if your goal is to do speech recognition, then I think the laptop can use 10/12/16 bit resolution ADC to convert MAX4466 mic amp to digital to pass it to Rpi for speech processing. – tlfong01 Jun 16 '20 at 12:32
  • Have you had a look at pulseaudio? As far as I know it is able to use remote audio sources and sinks. – Ingo Jun 17 '20 at 07:17

0 Answers0