Recording a file as an intent

I’m a beginner but I have looked through a fair number of posts before asking this.

I want to make an intent that will store an audio file on (say) ‘please record’ and ‘stop recording’. I’m aware that there is (seems to be) audio pushed out to mqtt for satellites, but I can’t get paho to connect (socket error) and suspect anyway that this is a clumsy solution.

Also I’ve tried a simple script with pyaudio stuck at the end of an intent flow (I’m using node-red and a specialised, simple intent server using FastApi hanging off it). But, of course, Rhasspy owns the microphone at that stage. Also any approach using dsnoop (I’m not a big audio expert either) results, for example:
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave

So, now, I’m a bit stuck and looking for one or several ways forward. Thanks in advance!

This one has been on my list as well. I’ve thought about using a fixed recording length, and making an O/S call to arecord via a python snippet, but other things have distracted me :grinning: . If you make an progress, please post!
Thanks,
Jeff

I’ve got about two/three approaches at the moment 1. dsnoop in the Alsa sound configuration and 2. possible use of Jack, for which there is a Python library.

I’ve also tried to use a paho MQTT client on the internal audio stream, but it’s giving me socket error and I’m stuck there at the moment,

Finally, the Docker container currently uses /dev/snd maybe there’s an alternative to this?

I have a messy was of doing this now. I need to demo so I’m not recommending this but it ‘works’. I stop the Docker instance (therefore freeing the microphone), record and restart the instance with a bit of Python.

I’m also doing some audio transcribing using Ghost. But once I have the audio, Rhasspy can have the microphone back again and the transcribe is in background.

This little script will record 4 second of the hermes/audioFrame topic and save it to a file
Maybe it can give you some inspiration :slight_smile:

Hi, Thanks for this, in fact, I found it during the trawl for a solution. However, on my Pi4 install, it exits with a socket error, so I’ve stayed with the quick and dirty (stop docker, record, start docker) for current demos.

It may be ‘something’ to do with the last reply to this:

but I’m not enough of an MQTT or Paho expert to know?

I’d really prefer something like this in the final version, so thanks again, best Hugh