A simple Demo to show how to use the MicroPi Node as well as the the Microphone Node in combination with the Wav-Filewriter Node to record Audio Files on a Raspberry Pi with an external USB interface.
-
-
Save MarkusWals/2267b12494608d62037e2f8043b955ae to your computer and use it in GitHub Desktop.
MicroPi Microphone Wav-Filewriter [Demo Flow]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"a05c1517.d1b518","type":"microPi","z":"97d0e573.552e58","name":"microPi","filename":"/home/pi/audio/demo.wav","domain":"http://localhost:1880/getAudio","rate":"16000","bitwidth":"16","endian":"little","encoding":"signed-integer","channels":"1","silence":"5","debug":"false","mode":"","x":500,"y":240,"wires":[["242b3c43.2ee8c4"],["2312eb0a.f1b494"],["f3a1701c.f7b0e"]]},{"id":"cf008b0c.048058","type":"inject","z":"97d0e573.552e58","name":"record","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":150,"y":180,"wires":[["a05c1517.d1b518"]]},{"id":"12db4a9.adbb7b5","type":"inject","z":"97d0e573.552e58","name":"stop","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":150,"y":220,"wires":[["a05c1517.d1b518"]]},{"id":"5769f387.a1d7bc","type":"http in","z":"97d0e573.552e58","name":"","url":"/record","method":"post","swaggerDoc":"","x":150,"y":280,"wires":[["774db6b2.a11ab8"]]},{"id":"34ad42f1.0ff19e","type":"http in","z":"97d0e573.552e58","name":"","url":"/stop","method":"post","swaggerDoc":"","x":140,"y":320,"wires":[["774db6b2.a11ab8"]]},{"id":"774db6b2.a11ab8","type":"function","z":"97d0e573.552e58","name":"","func":"if(msg.payload.recording == \"true\") {\n return {payload:true};\n} else if(msg.payload.recording == \"false\"){\n return {payload:false};\n}\n","outputs":1,"noerr":0,"x":310,"y":300,"wires":[["a05c1517.d1b518"]]},{"id":"242b3c43.2ee8c4","type":"debug","z":"97d0e573.552e58","name":"Raw L16 Wave Stream","active":false,"console":"false","complete":"true","x":750,"y":200,"wires":[]},{"id":"2312eb0a.f1b494","type":"debug","z":"97d0e573.552e58","name":"Wav File as a Buffer and metadata","active":false,"console":"false","complete":"true","x":780,"y":240,"wires":[]},{"id":"f3a1701c.f7b0e","type":"debug","z":"97d0e573.552e58","name":"Status Messages","active":false,"console":"false","complete":"true","x":730,"y":280,"wires":[]},{"id":"60d2b323.dcc4bc","type":"http in","z":"97d0e573.552e58","name":"","url":"/getAudio/","method":"get","swaggerDoc":"","x":160,"y":660,"wires":[["b1982777.ba6068"]]},{"id":"b1982777.ba6068","type":"file in","z":"97d0e573.552e58","name":"","filename":"/home/pi/audio/demo.wav","format":"","x":430,"y":660,"wires":[["a84ae484.d92378"]]},{"id":"a84ae484.d92378","type":"http response","z":"97d0e573.552e58","name":"","x":690,"y":660,"wires":[]},{"id":"447d5e57.866d7","type":"rpi-gpio in","z":"97d0e573.552e58","name":"","pin":"7","intype":"down","debounce":"1000","read":true,"x":130,"y":380,"wires":[["af5c03d6.f7574"]]},{"id":"af5c03d6.f7574","type":"function","z":"97d0e573.552e58","name":"","func":"if(msg.payload === 1)\n{ return {payload:true}; } \nelse \n{ return {payload:false}; }","outputs":1,"noerr":0,"x":310,"y":380,"wires":[["a05c1517.d1b518"]]},{"id":"d4606eb3.2b755","type":"comment","z":"97d0e573.552e58","name":"MicroPi Node Pack - Demo Flow","info":"","x":210,"y":80,"wires":[]},{"id":"4444147.9ebe1ec","type":"comment","z":"97d0e573.552e58","name":"Micropi","info":"","x":130,"y":140,"wires":[]},{"id":"a7d7f516.3c84d8","type":"comment","z":"97d0e573.552e58","name":"Audio Rest Api","info":"","x":160,"y":620,"wires":[]},{"id":"8190c3b6.bccc1","type":"microphone","z":"97d0e573.552e58","name":"microphone","endian":"little","bitwidth":"16","encoding":"signed-integer","channels":"1","rate":"22050","silence":10,"debug":false,"active":false,"x":170,"y":520,"wires":[["76f459d.ca67ba8"]]},{"id":"76f459d.ca67ba8","type":"wav-filewriter","z":"97d0e573.552e58","name":"","path":"","mode":"700","x":390,"y":520,"wires":[["ff81bc0.5e39948"]]},{"id":"f546a31e.f5eca","type":"comment","z":"97d0e573.552e58","name":"Microphone and Wav-Filewriter","info":"","x":210,"y":480,"wires":[]},{"id":"ff81bc0.5e39948","type":"debug","z":"97d0e573.552e58","name":"Wav File as a Buffer","active":true,"console":"false","complete":"true","x":640,"y":520,"wires":[]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thnaks for this sample flow.
One quesiton. Is it possible to stop recording sound and continue flow on silence ?
Thanks