Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.4k stars 976 forks source link

Multichannel output #1040

Closed cephasteom closed 2 years ago

cephasteom commented 2 years ago

I've trawled through the Web Audio API standard and suspect this isn't possible yet. But, in case it is. I've an audio interface with 16 outputs. I can route the browser through this and Tone has visibility over the amount of outputs available:

console.log(Tone.Destination.maxChannelCount)
// 32

What I'm looking for is the ability to route different synths to different output channels. Something like:

const synthA = new Tone.FMSynth()
const synthB = new Tone.MembraneSynth()
synthA.connect(0)
synthB.connect(2)

Is this possible?

Many thanks.

Pete.

chrisguttandin commented 2 years ago

I think what you're looking for can already be done with the ChannelSplitterNode and ChannelMergerNode.

Tone.js comes with a wrapper for both of them called Split and Merge respectively.

I hope this helps.

cephasteom commented 2 years ago

Thanks @chrisguttandin I'll give this a try. Are the docs generated from this repo? Ie. if I get a working example together can I contribute to the docs by opening a PR?

Many thanks,

Pete.

chrisguttandin commented 2 years ago

Yes, the docs are generated from the source code. I'm not the owner of this repo but I would assume that @tambien values your contribution to the docs.

cephasteom commented 2 years ago

Grand.