1

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 Answers1

1

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.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • Look in to MPD (Music Player Daemon) and MPC (Program for controlling Music Player Daemon), once you get text from Google Speech-to-Text API, use MPC to send command to MPD, which is configured for Internet Radio (using Playlists). I did it using Snowboy(Hotword) + Pocketsphinx (STT) + MPC + MPD. When I say "Play JAZZ" in microphone, app will play "Jazz Internet Radio", other commands like PLAY STOP RESUME PAUSE EXIT also supported. – g10dras Feb 05 '19 at 04:26
  • here is an example which shows play songs locally. https://www.youtube.com/watch?v=-CZvC4g5ZUk – g10dras Feb 05 '19 at 04:31