Streaming webradio using PyAudio

581 Views Asked by At

I am fiddling around w/ snowboy and PyAudio. I want to automatically listen to a web radio, listen for a hotword via snowboy, record the succeeding X seconds, pass them via SpeechRecognition to the Google Speech-to-Text API and send an email with the contents to myself. I wrote a working proof of concept, which listens to my microphone and does everthing mentioned above. Unfortunately, I am not able to get PyAudio to work with an online audio stream provided by a simple .pls file. Does anyone know if this is an intended use case of PyAudio? Is this even possible to accomplish? If not, does anyone know of an alternative to listen to an audio stream and provide it either via PyAudio or another library to snowboy?

Thanks in advance. ;)

1

There are 1 best solutions below

2
On BEST ANSWER

You do not need pyaudio, it is a module to record from the microphone, instead you have to implement your own class to read from a stream like snowboydecoder_arecord. To create stream from pls try ffmpeg-python.