MicroPi not running properly

Hello to all,

I am trying to have MicroPi work, but I can't. Why is that? Is there something specific I must undestand before?

I have tried with the MicroPi Microphone Wav-Filewriter [Demo Flow] and of course installed the MicroPi nodes. I have indicated a path with a file name. Just wandering why it does not ask which microphone I am using.

There is a response underneath the node which indicates it is recording. But I get nothing in the debug pane and no created file.

It looks like node-red-contrib-micropi hasn't been update in 4 years. You might want to explore the FLOWS tab here on th e forum and see if there is another microphone node that will work for you.

You might try out node-red-contrib-sox-utils which is in beta but I have gotten it to work with my usb mic on a Mac and a Pi


Thank you. I would not have found this without your help.
I will try that

@JGKK I am testing Sox utils but it seems it does not find my device plughw:CameraB409241

ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM input
sox FAIL formats: can't open input  `default': snd_pcm_open error: No such file or directory

Did you use the dropdown to choose your device or the manual input for device choice? Doesn’t it show the card as a selection in the dropdown?
Or did you try the default option because that sometimes will only work if you actually configured a default for recording.
If you want to use the manual input option here is what you need to do as its not in the readme yet. It has to be in the format of the sox commandline argument for choosing a device.
You can go/ssh to your commandline and use arecord -l which will give you an output like this:

pi@testipi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: ArrayUAC10 [ReSpeaker 4 Mic Array (UAC1.0)], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

This will be similar for your attached mic (playstation eye?). What this tells you is its sound device 1 and subdevice 0 you want to use. Of course those numbers can differ.
This translates to:

-t alsa hw:1,0

as an input for the manual device input field in the node.
But if you can see the mic with arecord -l this shouldn’t be necessary as the device should be shown in the nodes source dropdown.


1 Like

Just got one of the old ps eye cams out of the box in Storage and updated a nodered to the latest sox-utils node.
Here is what I see when I do arecord -l just after I plugged in the ps eyecam:

**** List of CAPTURE Hardware Devices ****
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: CameraB409241 [USB Camera-B4.09.24.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

So the cam is device 2 sub 0.
If I go to the node it’s also in the dropdown:

And if I choose it this is what I get:

As expected but I can also use the manual source selection:

Which works also as expected:

Can you post some screenshots of what the node shows for you and what you arecord -l output is?


Edit and PS

I just checked and the error is similar to what I get when I define a default in the asound.conf and don’t actually have that device connected or when there is no default defined at all which is the case for recording devices if you didn’t define one in the asound.conf as the raspberrypi and most other Linux soc s don’t have an inbuilt audio input. So I think it’s one of those two but you should just be able to choose it from the dropdown or use the method above to enter it manually if on any Linux which uses alsa.
You could also define the mic as default in your /etc/asound.conf file. (You need to edit it with sudo) and once defined there use the default option (dont do this if your running pulseaudio and always make a backup copy of the previous asound.conf file before you change it):

pcm.!default {
    type asym
    playback.pcm "speaker"
    capture.pcm "array"

pcm.speaker {
    type plug
    slave.pcm "hw:ALSA"

pcm.array {
    type plug
    slave.pcm "hw:CameraB409241"
1 Like

Thank you Johannes for all this. Now I have an error: Device or resource busy as you can see.

I had Rhasspy running on an other flow, but I deleted it. I can't see no reason why the microphone should be busy.

By the way, I have no dop down list.

pi@raspberrypi:~ $ arecord -l
**** Liste des Périphériques Matériels CAPTURE ****
carte 2: CameraB409241 [USB Camera-B4.09.24.1], périphérique 0: USB Audio [USB Audio]
  Sous-périphériques: 0/1
  Sous-périphérique #0: subdevice #0

My .asoundrc file:

pcm.!default {
	type asym
	playback.pcm {
		type plug
		slave.pcm "output"
	capture.pcm {
		type plug
		slave.pcm "input"

pcm.input {
	type hw
	card 2

pcm.output {
	type hw
	card 1

ctl.!default {
	type hw
	card 1

I have stopped and restarted nodered, but it does not help.

Hmm I think I know why the dropdown doesn’t work. I use a regex to generate the entries for the dropdown from the systems list. I think this fails with any system language other than English unfortunately. As for the resource busy, this only happens when the resource is used / blocked by something else. just as a Note I’m not quite sure about the syntax in your asoundrc either. I would define it as above in my example as using card Numbers instead of names there can lead to many errors as cards can change their order on a reboot.
Are you sure Rhasspy or any other possible programs released the sound resources? If you do a simple arecord command from the command line is it busy too?
I would do a reboot just in case. Unplug the PlayStation Eye before rebooting as it can block a boot on the pi.

I'm stupid. I erased a flow connected to Rhasspy, but Rhasspy was still running in docker... Actually it all works!

Now I suppose there is no possibility to have both running using the same microphone?

What I'd like to do is take a quick recorded message after a specific intent in Rhasspy. But this is more a topic for Rhasspy...
An http request in the form http://localhost:12101/api/stop-recording would probably do it, but the recording with sox-record starts too soon.

Yes that is possible. You will have to use a soundserver that sits on top of alsa.
Do you have pulseaudio installed? I think it comes standard with the Desktop version of Raspberrypi OS but if you use the light headless version like me you have to install it.
So first do a

pulseaudio --version

Which should give you something like:

pulseaudio 12.2

Otherwise install it using:

sudo apt-get install pulseaudio pulseaudio-utils

If it’s installed.
Second check if it’s running already using top or htop.
If it’s running you need to kill it as you need to start it in systemwide mode using:

sudo pulseaudio -D --system

than add the user running nodered to the pulseaudio and pulseaudio-access groups, for example:

sudo adduser pi pulse
sudo adduser pi pulse-access

Now install the handler for pulse audio in sox

sudo apt-get install libsox-fmt-pulse

Now you can use:

-t pulseaudio default

as the manual source for recording from nodered. And as pulseaudio sinks are non blocking you could also use a sox record command as your record command in Rhasspy pointing to the same sink.
But be warned pulseaudio can be fiddly especially running in systemwide mode and you would need to add system d script to start it automatically when you boot.

You mean I would not need to stop Rhasppy listening with this trick?

I knox how fiddly pulseaudio can be. Have stopped trying to use it twice recently. But if you say it can be THE solution, i will try again.

Pulseaudio is now part of the recent distribution of Raspberry Pi OS. So I have to try and live with that.

Yes as pulseaudio sinks are non blocking. But it will only work with nodered if the user running nodered is part of the pulse groups and pulse audio is running in systemwide mode.
You can than use the command:

pactl list

to get all devices. This will get you a very long list. If you look for the Source headers in that list you can find the name of individual source devices and use those in the manual input source in the node like for example:

-t pulseaudio alsa_input.usb-SEEED_ReSpeaker_4_Mic_Array__UAC1.0_-00.analog-mono

Of course the same goes for Rhasspy. Add the user running Rhasspy to the right groups and use something like:

sox -q -t pulseaudio alsa_input.usb-SEEED_ReSpeaker_4_Mic_Array__UAC1.0_-00.analog-mono -L -e signed-integer -c 1 -r 16000 -b 16 -t wav -

as a custom record command which is pretty similar to what the sox node uses in the background. You could also use the pulseaudio native parec command of course but you would have to look up the syntax for that yourself as i have never used it.

Another thought, as the audio chunks in Rhasspy are beeing handled over mqtt with the hermes protocol couldn’t you subscribe to that topic?


The sox record node is able to record from a stream of buffers.
Than you wouldn’t have any need for pulseaudio.

Would this affect my choice for PyAudio and Snowboy for audio input and wake word detection?

I really don’t know. I don’t use rhasspy myself as i use voice2json. I only have a passing similarity with the hermes protocol as i used to use snips.
Shouldn’t pyaudio also work with pulseaudio?
You probably need system wide mode and correct group membership too but it should work.

After all this, I will have a look at voice2json which is given to work well in combination with nodered.

I followed your instructions for pulseaudio and I tried -t pulseaudio default. Recording starts but the flow is nill. I have lots of In:0.00% 00:00:00.00 [00:00:00.00] Out:0 [ | ] Clip:0

I checked for the input device with pactl list as you suggested, but I can't find my microphone.

One other thing: the settings in the sox-record node are ignored in the output

Input File     : 'default' (pulseaudio)
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

EDIT: I'm just thinking, I need to modify the content of my .asoundrc file.

Thats just the input settings, its the native format of the source your using. This gets converted to the format from the nodes settings. When you play a recorded wav you will see it has the settings from the node. This can be confusing but thats just how linux audio is.

Can you copy the output to a txt file and send to me as a pm?

I really recommend to use the global /etc/asound.conf as per my example above in this case as the user specific asoundrc can cause trouble as its not necessarily picked up by sox running from nodered or pulseaudio which is running under its own user.

Please do, Im the main developer of the nodered nodes for Voice2json and im always happy about feedback and bug reports.


One more thing when you did the pactl list command where you running Rhasspy or Nodered recording from the mic with alsa at the same time?
Because devices in use from the lower level of alsa at the time will not show up in the pulseaudio source list as alsa is blocking them when in use.

That was it for one thing. I stopped Rhasspy and I could get the expected result.
So that I tried with -t pulseaudio alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input in the node.

But recording won't start
sox FAIL formats: can't open input 'alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input': can not open audio device: Connection refused
even after I added an asound.conf file in /etc

pcm.!default {
    type pulse
    playback.pcm "speaker"
    capture.pcm "array"

pcm.speaker {
    type plug
    slave.pcm "hw:ALSA"

pcm.array {
    type plug
    slave.pcm "hw:CameraB409241"

Even after reboot...

Are you sure your running pulseaudio as systemwide daemon and that the user running nodered is part of the pulse and the pulse-access group?
I just plugged the ps eye into a test pi. I did not change anything in the asound.conf or asoundrc file so its not system default its just plugged in.
I did pactl list and got this:

Source #3
        State: SUSPENDED
        Name: alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input
        Description: Sony Playstation Eye Multichannel
        Driver: module-alsa-card.c
        Sample Specification: s16le 4ch 16000Hz
        Channel Map: front-left,front-right,rear-left,rear-right
        Owner Module: 12
        Mute: no
        Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB,   rear-left: 65536 / 100% / 0.00 dB,   rear-right: 65536 / 100% / 0.00 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor of Sink: n/a
        Latency: 0 usec, configured 0 usec
                alsa.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "USB Audio"
                alsa.id = "USB Audio"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "2"
                alsa.card_name = "USB Camera-B4.09.24.1"
                alsa.long_card_name = "OmniVision Technologies, Inc. USB Camera-B4.09.24.1 at usb-0000:01:00.0-1.3, hi"
                alsa.driver_name = "snd_usb_audio"
                device.bus_path = "platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.1"
                sysfs.path = "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.1/sound/card2"
                udev.id = "usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01"
                device.bus = "usb"
                device.vendor.id = "1415"
                device.vendor.name = "Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc."
                device.product.id = "2000"
                device.product.name = "Sony Playstation Eye"
                device.serial = "OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1"
                device.string = "hw:2"
                device.buffering.buffer_size = "256000"
                device.buffering.fragment_size = "128000"
                device.access_mode = "mmap+timer"
                device.profile.name = "multichannel-input"
                device.profile.description = "Multichannel"
                device.description = "Sony Playstation Eye Multichannel"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-usb"

copied the name and set up a sox record node like this:

and the recording worked no problem:

Im even using voice2json right now streaming from the Playstation eye with the sox record node to the wake word node and this works no problem.
As its pulse I just tested and I can record from it with another record node at the same time no problem.
And as I said the Playstation Eye is not in my asound.conf I just plugged it in and went straight to nodered.

Also making sure when you tried recording from nodered you hadn’t started Rhasspy back up or you were using pulseaudio as a source from Rhasspy.

You are right, I must check that on each boot. Now it works, but only without Rhasspy running in docker.
I have made several tests and one of them leads to freezing sox-record, with these steps:

  • booting without rhasspy

  • checking for the microphone with pactl list and the system wide daemon with sudo pulseaudio -D --system (user pi is always ok)

  • sox-record is ok at this stage

  • starting rhasspy

  • sox-record is then frozen

My asound.conf along this

pcm.!default {
    type pulse
    playback.pcm "speaker"
    capture.pcm "array"

pcm.speaker {
    type plug
    slave.pcm "hw:ALSA"

pcm.array {
    type plug
    slave.pcm "hw:CameraB409241"

With the same configuration, if I boot with Rhasspy and add the system wide daemon, I get sox FAIL formats: can't open input 'alsa_input.usb-OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1-01.multichannel-input': can not open audio device: No such entity