mattdiamond / Recorderjs

A plugin for recording/exporting the output of Web Audio API nodes
4.17k stars 1.46k forks source link

connecting multiple sources #42

Open squiles opened 10 years ago

squiles commented 10 years ago

Is it possible to connect more than one source to the recording node? What I would like to do is have to sources playing simultaneously and record those two sounds with a single record node. Is this possible?

cwilso commented 10 years ago

Of course. Web Audio supports fan-in.

Since RecorderJS needs a single source node, just create a gain node, connect() multiple source nodes to it, and then create the recording node with the gain as its source.

sotoole commented 10 years ago

This made perfect sense to me when I read it, but when I went to code it...massive FAIL. Any chance you could give a quick code sample?

I managed to create a 'masterGain' node (4 sources -> 4 gain nodes -> 1 master gain node), but I can't seem to get this 'masterGain' node as the buffer for the record function. Help...

cwilso commented 10 years ago

The master gain node is the one you pass to recorderJS as the source node.

christophersbarrett commented 10 years ago

On a similar note, is there a way to programmatically chose which microphone to record from? I know you can set it in chrome either as default or manually...

cwilso commented 10 years ago

Yes, it is possible, using constraints on the getUserMedia call along with getSources(). Currently only works on Chrome (30+). Check out https://simpl.info/getusermedia/sources/index.html.

On Thu, Feb 13, 2014 at 6:48 AM, Chris Barrett notifications@github.comwrote:

On a similar note, is there a way to programmatically chose which microphone to record from? I know you can set it in chrome either as default or manually...

Reply to this email directly or view it on GitHubhttps://github.com/mattdiamond/Recorderjs/issues/42#issuecomment-34984585 .