how to connect the computer microphone in a RNBO web export patch

Sarunas Kilius's icon

Hello,

I am trying to build a simple patch, where I take computer microphone audio as an input and perform some audio processing using a RNBO patch. I have struggled to access the microphone via JS but not sure how to connect it to the patch.

I have used the code to reference an audio buffer as provided in here:
https://rnbo.cycling74.com/learn/buffers-and-file-dependencies#usage-example

However, I am not sure how to assign the audio stream from the microphone to the buffer variable in JS.

For accessing the microphone, I have used the code as provided here:
https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Build_a_phone_with_peerjs/Connect_peers/Get_microphone_permission

But I am not sure how to access the stream as a variable and if i need to convert it to a specific format before i can assign it as a buffer.

Any help would be appreciated!

Tommy Martinez's icon