Hi to you all,
Im pretty new in this forun and also on node red.
Has part of my final high school project i need to record audio (via user mic) from the dashboard and play it through the raspberry pi speakers.
- I have searched the web alots of times but i didnt found the answer.
- I dont use the Microphone UI node becouse its doesnt integrated with my other Dashboard Nodes. (When i put this node in the editor, i cannot see any other UI nodes in the dashboard.
- This is flow i am trying to use
(A dashboard tempmete to implement browser recording to the sox play node):
[
{
"id": "84b603f51c69a255",
"type": "ui_template",
"z": "b912939ba17bf70c",
"g": "e93feab2be728c8c",
"group": "39e549dfe3be6225",
"name": "",
"order": 30,
"width": 4,
"height": 1,
"format": "<div class=\"form-group\">\n <div id=\"recording\">\n <button type=\"button\" id=\"record\">\n <i class=\"material-icons\">mic </i>\n <button type=\"button\" id=\"stop\">\n <i class=\"material-icons\">stop</i>\n </button>\n </div>\n <div id=\"processing\">\n </div>\n</div>\n<script>\nvar recordButton, stopButton, recorder, audio, msg;\nwindow.onload = function() {\n recorder = new MediaRecorder(stream, options);\n recordButton = document.getElementById('record');\n stopButton = document.getElementById('stop');\n navigator.mediaDevices.getUserMedia({ audio: true })\n .then(function(stream) {\n recordButton.addEventListener('click', startRecording);\n stopButton.addEventListener('click', stopRecording);\n}\nfunction startRecording() {\n recorder.addEventListener('dataavailable', onRecordingReady);\n function() {\n recordButton.disabled = true;\n stopButton.disabled = true;\n $(\"#audioMediaNotAvailable\").show();\n });\n //navigator.mediaDevices.getUserMedia({audio: true})\n recorder.start();\n }\nfunction stopRecording() {\n recorder.stop();\n var audio = document.getElementById('audio');\n audio = e.data;\n msg.payload = audio;\n return msg.payload;\n}\nfunction onRecordingReady(e) {\n var audio = document.getElementById('audio');\n audio = e.data;\n msg.payload = audio;\n return msg.payload;\n}\n</script>\n\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"x": 220,
"y": 2840,
"wires": [
[
"8e47fca2fddfbba8",
"58ca7699327f1622"
]
]
},
{
"id": "8e47fca2fddfbba8",
"type": "sox-play",
"z": "b912939ba17bf70c",
"g": "e93feab2be728c8c",
"name": "",
"outputDevice": "default",
"manualOutput": "",
"gain": "0",
"startNew": "skip",
"playStream": true,
"inputEncoding": "signed-integer",
"inputChannels": 1,
"inputRate": 16000,
"inputBits": 16,
"debugOutput": false,
"x": 560,
"y": 2780,
"wires": [
[]
]
},
{
"id": "39e549dfe3be6225",
"type": "ui_group",
"name": "PetCareSystemUI",
"tab": "3a10e87df447c6fb",
"order": 1,
"disp": true,
"width": 30,
"collapse": false
},
{
"id": "3a10e87df447c6fb",
"type": "ui_tab",
"name": "PetCareSystem",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
- My current setup is:
Raspberry pi 3b+
Node red
Speakers (connected Trough the pl plug)
PLEASE Help me (i need to submit it in 12 o'clock today )