I've just published a new Dashboard node for capturing audio from the microphone.
It gives you a simple button in the dashboard that when clicked starts recording until the button is clicked again or the configured max-length is reached. The audio is then published from the node as a Buffer containing the WAV data.
It uses the MediaRecorder API that is widely supported, however:
- no support in IE at all - don't ask
- it needs to be enabled in Safari (
Develop -> Experimental Features -> MediaRecorder)
This is very much a minimum-viable-node to address an immediate need. There are some ideas for further features such as:
- timeslicing the recording so it publishes at regular intervals whilst recording rather than just at the end
- automatically detect (relative) silence to stop the recording - found some good blog posts on how to do this in principle
- some more UI options such as adding a time count
And I have no doubt you will all throw back some ideas. Just be aware I'm not planning on spending a huge amount of more time on this right now having got it working for my immediate needs.
You can see it in action here: https://www.youtube.com/watch?v=CxiwO4nxSgI
The microphone node is wired straight to an HTTP Request node that posts the audio to the IBM Watson Speech To Text service (Puts on IBMer hat - free to sign up for without a credit card, the lite plan gives you 500 minutes of speech-to-text a month). The response is passed to a ui_text node.
It's pleasing when these things Just Work.
@BartButenaers I did do some due diligence before starting to write this node, and of course it was only just after I hit publish did I stumble over your https://www.npmjs.com/package/node-red-contrib-ui-media-source node. But I note its in beta and has no
node-red keyword, so I don't feel too bad about not finding it.