Microphone node not recording

I can't get the node-red-contrib-mic to record reliably.
I have the correct stuff in it I think, this is what it looks like:


and I know my device identity(? is that the right word?) is plug:1,0 because not only is it listed under the hardware devices, I can record and listen to audio through my little ReSpeaker.

So far, it has worked periodically. Like, I would get a seemingly random message to merge; "The server is running a more recent set of flows."
I don't think it's that notification specifically, but yeah. And then I would choose between the conflicts, and then merge, and then the microphone would randomly start working, which is how I got by. Now I am not getting those messages to get the microphone working, and it simply won't start recording.
Maybe this whole "merge" thing is a very red-herring sort of solution, but I thought it could be relevant information nonetheless

Node-RED v4.0.5
Node.js v20.17.0
Linux 6.1.21-v8+ arm64 LE

Oh yeah, this is what the microphone looks like in the flow:


Pressing the inject button injects a "start" string into the mic node, and I then get: "Successfully injected: start".
The mic node doesn't do anything in response, where it should display some text below it saying "recording", alongside a red square.

Another things about the weird "merge" solutions, I tried artificially creating those merge notification by creating conflicts in a different window, and it only worked the first time, nothing since then.

That node has not been updated in 8 years and the author hasn't been seen on GitHub for a number of years so you're pretty much on your own. You can look over the readme on GitHub and see if that helps you.

Augh, that's frustrating.
Right now, I am looking at the possibility of using exec nodes as an alternate solution.
Other than that, I am relying on pure randomness.

okay, something interesting caught my eye, in the mic node documentation, it says for the input device: "Device: hw:0,0 or plughw:1,0 or anything valid supported by arecord, default: plughw:1,0"
the thing I am interested in here, is the "anything valid supported by arecord", so while I've been trying to get the exec nodes to work, I have tried using the arecord stuff, and the errors that are passed claim that "no such command exists", despite me being able to easily run arecord in the CLI, which also lines up perfectly with my experience with the mic node, I think somewhere along the way, arecord stopped working in nodered, and in doing so, the mic node has stopped working, so my fix lies in getting arecord to start working again.

if anyone knows some tips to get it working, I am ALL ears

If using an exec node make sure you put the full path to the command. Use the which command to find where it is

which arecord
/usr/bin/arecord

Then use /usr/bin/arecord in the exec node.

If you still get the error add debug nodes, Outputing full msg, to all three exec node outputs and check for error messages.

Yeah, I think something is wrong with my setup of NodeRed in particular

I really don't know where NodeRed is going wrong here.

Is node red running in docker or similar?

Show us how you have configured the exec node. In fact select it, the inject node and debug nodes, export it, and paste here, so we can try.

[
    {
        "id": "inject-start",
        "type": "inject",
        "z": "81728fad65704a61",
        "name": "Start Recording",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "start",
        "payloadType": "str",
        "x": 535,
        "y": 600,
        "wires": [
            [
                "exec-start-recording"
            ]
        ]
    },
    {
        "id": "exec-start-recording",
        "type": "exec",
        "z": "81728fad65704a61",
        "command": "/usr/bin/arecord -l",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "Record Audio",
        "x": 735,
        "y": 600,
        "wires": [
            [
                "6841928b13bf9315"
            ],
            [
                "6841928b13bf9315"
            ],
            [
                "6841928b13bf9315"
            ]
        ]
    },
    {
        "id": "6841928b13bf9315",
        "type": "debug",
        "z": "81728fad65704a61",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 970,
        "y": 600,
        "wires": []
    }
]

there we are, I moved arecord out of "local", so it looks slightly different, but yeah, this is it

You didn't answer:

it's running on docker exactly, yes

That is why it does not work. You can't (or at least cannot normally) run s/w that is installed outside of the container. Nor can you access hardware on the host system unless you configure docker accordingly. That will also be why the microphone node does not work. I suggest installing node red natively instead of in docker.

1 Like

okay, i see then
I will try that, thanks!

It worked, the microphone goes into a recording state now.
New problem though, it doesn't pass any data. I'll work on it a little more just in case i configured it wrong

This worked pretty good, the microphone node not passing data was fixed with removing and reinstalling it.
The merge notification fixing the microphone node before was probably due to the flow running locally for a little bit, as the remote and local versions become merged.

Thanks for replying and reading :+1: