Skip to main content

Recording Audio

You can record audio from the device's microphone using the RecorderNode audio graph sink node.

Instantiating

You can instantiate an RecorderNode with the following parameters:

  • sampleRate: Sample rate of the recording.
  • numberOfChannels: The number of the desired recording channels.
note

You also have to enable microphone access in the audio engine for the recording to work.

{
"nodes": {
{ "id": "recorderNode", "type": "RecorderNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "recorderNode" }
},
"tracks": {
"recorderNode": "recording.mp3"
}
}

Recording Functions

For controlling the recording, you have the following functions:

  • start(): Starts recording.
  • stop(filePath: String, Codec): Stops the recording and saves the recorded audio to a specified path with the Codec given.

Listening to the Recording

You can input the filePath in the stop function to an AudioPlayerNode to listen to your recorded audio. See how to do it here