MicroPi does not record audio

Hi Node Red Community,
i want to record audio using the MicroPi, because i need the raw data, with an USB mic.
The problem i have is that the files that are being saved are just empty shells with no contend.
I tried different images and different hardware but nothing seems to fix the problem.
The funny thing is that when i use the ui_microphone everything does work and the files are not empty.
Here is my flow:

Thank you.
Cheers

[{"id":"2035a9c9.624d36","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"32773959.5299b6","type":"inject","z":"2035a9c9.624d36","name":"record","repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"true","payloadType":"bool","x":550,"y":260,"wires":[[]]},{"id":"3753cc7d.db7f04","type":"inject","z":"2035a9c9.624d36","name":"stop","repeat":"","crontab":"","once":false,"topic":"","payload":"false","payloadType":"bool","x":550,"y":300,"wires":[[]]},{"id":"76f237f5.296d48","type":"debug","z":"2035a9c9.624d36","name":"Raw L16 Wave Stream","active":false,"console":"false","complete":"true","x":1150,"y":280,"wires":[]},{"id":"3adbc468.f9338c","type":"debug","z":"2035a9c9.624d36","name":"Wav File as a Buffer and metadata","active":true,"console":"false","complete":"true","x":1180,"y":320,"wires":[]},{"id":"2569e4d3.5af8bc","type":"debug","z":"2035a9c9.624d36","name":"Status Messages","active":false,"console":"false","complete":"true","x":1130,"y":360,"wires":[]},{"id":"c469bfb7.f2b7f","type":"comment","z":"2035a9c9.624d36","name":"MicroPi Node Pack - Demo Flow","info":"","x":610,"y":160,"wires":[]},{"id":"b3fc88a6.454a58","type":"comment","z":"2035a9c9.624d36","name":"Micropi","info":"","x":530,"y":220,"wires":[]},{"id":"1a2e1afe.2db8b5","type":"function","z":"2035a9c9.624d36","name":"","func":"date = Date.now();\n//day = date.prototype.getDate();\n//month = date.prototype.getMonth();\n//year = date.prototype.getFullYear();\n//hours = date.prototype.getHours();\n//min = date.prototype.getMinutes();\n//sec = date.prototype.getSeconds();\n\n//formated_date = year + month + day + \"_\" + hours + min + sec;\n\nmsg.filename = \"/home/pi/audio/charlotte_\" + date;\nreturn msg;","outputs":1,"noerr":0,"x":1160,"y":440,"wires":[["80c4f35e.a3b27"]]},{"id":"35f8c5f2.19dcfa","type":"file in","z":"2035a9c9.624d36","name":"","filename":"/home/pi/audio/demo.wav","format":"","chunk":false,"sendError":false,"encoding":"none","x":950,"y":460,"wires":[["1a2e1afe.2db8b5"]]},{"id":"80c4f35e.a3b27","type":"file","z":"2035a9c9.624d36","name":"","filename":"","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":1350,"y":440,"wires":[[]]},{"id":"d8fe772.5986d88","type":"fft","z":"2035a9c9.624d36","input":"payload","singleValue":true,"fields":"accelerometer_x,accelerometer_y,accelerometer_z","inputType":"msg","transformType":"real","out_prefix":"fft_","x":1170,"y":500,"wires":[["a97c9bce.9c7b28"]]},{"id":"e5bcbcd2.0a1ff","type":"ui_chart","z":"2035a9c9.624d36","name":"","group":"cd78e7e8.b58278","order":2,"width":13,"height":4,"label":"Akustik ","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"20000","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"1","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1565,"y":216,"wires":[[]]},{"id":"6367d750.f44058","type":"ui_gauge","z":"2035a9c9.624d36","name":"","group":"b033e834.2f19b8","order":2,"width":0,"height":0,"gtype":"gage","title":"Akustik ","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1567.5,"y":167,"wires":[]},{"id":"67b3df52.fc98d","type":"ui_gauge","z":"2035a9c9.624d36","name":"","group":"b033e834.2f19b8","order":1,"width":0,"height":0,"gtype":"gage","title":"Vibration","label":"mm/s²","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1575,"y":307,"wires":[]},{"id":"78711767.564cc8","type":"ui_chart","z":"2035a9c9.624d36","name":"","group":"cd78e7e8.b58278","order":1,"width":13,"height":4,"label":"Vibration [mm/s²]","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"20000","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1604,"y":358,"wires":[[]]},{"id":"26a8afda.e6bfb","type":"ui_gauge","z":"2035a9c9.624d36","name":"","group":"b033e834.2f19b8","order":3,"width":0,"height":0,"gtype":"gage","title":"Strom","label":"A","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1568,"y":449,"wires":[]},{"id":"a97c9bce.9c7b28","type":"ui_chart","z":"2035a9c9.624d36","name":"","group":"cd78e7e8.b58278","order":3,"width":13,"height":4,"label":"Strom [A]","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"400","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1577,"y":500,"wires":[[]]},{"id":"143fadf4.d1ab22","type":"ui_switch","z":"2035a9c9.624d36","name":"","label":"STOP/START","tooltip":"","group":"e6b77531.995c88","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":696.5,"y":386,"wires":[["6ce71b32.c028e4"]]},{"id":"3d3700eb.93818","type":"file","z":"2035a9c9.624d36","name":"","filename":"/home/pi/audio/mictest","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1190,"y":560,"wires":[[]]},{"id":"46f8ff13.8f477","type":"debug","z":"2035a9c9.624d36","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":980,"y":640,"wires":[]},{"id":"6ce71b32.c028e4","type":"microPi","z":"2035a9c9.624d36","name":"microPi","filename":"/home/pi/audio/demo.wav","domain":"http://localhost:1880","rate":"16000","bitwidth":"16","endian":"little","encoding":"signed-integer","channels":"1","silence":"0","debug":true,"mode":"666","x":880,"y":320,"wires":[["76f237f5.296d48"],["3adbc468.f9338c","35f8c5f2.19dcfa","735fde7.d701a2"],["2569e4d3.5af8bc"]]},{"id":"3b87ad8a.0030c2","type":"microphone","z":"2035a9c9.624d36","name":"microphone","endian":"little","bitwidth":"16","encoding":"signed-integer","channels":"1","rate":"22050","silence":10,"debug":false,"active":true,"x":650,"y":580,"wires":[["46f8ff13.8f477","ee40cc40.820ec"]]},{"id":"ee40cc40.820ec","type":"wav-filewriter","z":"2035a9c9.624d36","name":"","path":"","mode":"700","x":920,"y":520,"wires":[["3d3700eb.93818"]]},{"id":"735fde7.d701a2","type":"wav-headers","z":"2035a9c9.624d36","name":"","action":"add","channels":1,"samplerate":22050,"bitwidth":16,"x":1040,"y":220,"wires":[[],[]]},{"id":"cd78e7e8.b58278","type":"ui_group","name":"DIAGRAMM","tab":"85d92fc7.b2c7f","order":2,"disp":true,"width":"13","collapse":false},{"id":"b033e834.2f19b8","type":"ui_group","name":"ANZEIGE","tab":"85d92fc7.b2c7f","order":1,"disp":true,"width":6,"collapse":false},{"id":"e6b77531.995c88","type":"ui_group","name":"Control","tab":"85d92fc7.b2c7f","order":3,"disp":true,"width":"6","collapse":false},{"id":"85d92fc7.b2c7f","type":"ui_tab","name":"BOEHLERIT GUI","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

Why are you using the file-in node to attempt to write out the recording?

Access rights to folder /home/pi/audio ???

Are you sure you're recording from the right card? Can you see the raw buffer in the debug tab?

@zenofmud Because i want to have an Timestamp on the file for documentation. So it will be savered once in the micropi (gets overwritten) and another time in the file node. (including a time stamp)

@JGKK i can`t see anything in the debug. how can i check if i am recording from the right card?

Thank you all for the fast replies.

The file-in node reads a file, the file-outs node writes a file to storage. It looks like you are trying to write out a file but using the node that reads in a file.

I am reading the file that gets written by the micropi and then i am adding the timestamp via the function Node. After that i am saving it again. The problem i am having is that the file wich is written by die micropi is empty.

Well seeing how the micropi node hasn’t been updated in over 4 years you might be out of luck.
You might try the Sox node... let me see if I can find it

Ahh see this thread [update] node-red-contrib-sox-utils : beta

Thank you for the Link.
I tried this node aswell but no luck either.
I came across another possible problem. The thing is that the it is selectable as an input via the Pi but if i go to the terminal and use "lsusb" the Pi shows me that there is a device but i does not have a description(device name). On the other hand if i use the command "usbreset" it shows up in the devices category.
Could the mic itself be the Problem?
The strange thing is that the mic works if i use the website mictests.com.

Thank you for the great support
kind regards
Paul

Edit: never mind i tried with an different sd card an image and it worked. Still don't know the problem though

sox-utils is now installable via the pallete, it also includes the option to dynamically set the filename via the input msg with msg.filename.
This way you can save it straight to a wav file without having to change the filename otherwise.

Johannes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.