Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple inputs and outputs #28

Closed
mbylstra opened this issue Jun 24, 2017 · 5 comments
Closed

Support multiple inputs and outputs #28

mbylstra opened this issue Jun 24, 2017 · 5 comments

Comments

@mbylstra
Copy link

mbylstra commented Jun 24, 2017

Unless I've missed something, there doesn't seem to be support for AudioNodes that have multiple inputs or outputs such as ChannelSplitterNode (https://developer.mozilla.org/en-US/docs/Web/API/ChannelSplitterNode) and ChannelMergerNode (https://developer.mozilla.org/en-US/docs/Web/API/ChannelMergerNode).

This is essential for stereo effects.

With the current design, by using an array you can route a mono output to multiple different nodes (which have mono inputs), but for a node that supports multiple inputs (stereo, 6 channel surround, etc), there is no way of specifying the specific input to connect the output to.

For example, here is an example stereo delay using the Web Audio API:
https://github.com/web-audio-components/delay/blob/master/index.js#L154.
In this example, the first output of rightFilter is connected to the second input of _merge ( a ChannelMergerNode that takes two inputs in this configuration).

@mbylstra
Copy link
Author

Sorry, I missed this part of the documentation: https://github.com/benji6/virtual-audio-graph#channelsplitternode. I see how you've implemented it now.

@benji6
Copy link
Owner

benji6 commented Jun 24, 2017

No worries! Let me know if you have any questions or ideas on improving the documentation or the API!

@voodoohop
Copy link

@benji6 I can't figure out how to use the channelSplitter. When I just specify the output by just passing the key of the node I want to connect to it works but I cannot seem to get it connect with the {key, inputs, outputs} parameter. Any chance of an example code?

@benji6
Copy link
Owner

benji6 commented Nov 23, 2023

Hi @voodoohop, I think you have found the limited documentation here https://github.com/benji6/virtual-audio-graph/blob/master/docs/standard-nodes.md#channelsplitter.

key refers to the virtual node key you specify when you configure the graph and the inputs and outputs values are passed to the 2nd and 3rd arguments of the connect method under the hood https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/connect

Are you splitting something that has multiple channels? Sorry to flip this around, but do you have an example I can take a look at and help debug?

@voodoohop
Copy link

Thanks for your reply!

I think I'm using the syntax correctly but not 100% sure yet. What I'm doing is first splitting and then merging so I can map a number of stereo channels playing samples arbitrarily to the audio device output channels.

Love the idea behind your library. I'm prototyping a loop-based music-making app for the company that makes https://korus.co/.

https://layermosaic.pixelynx-ai.com/

I spent a day porting the code to use virtual-audio-graph and the whole design is going to be so much cleaner and simpler thanks to it.

I'm going to try and create a test case for this. Seems like the most efficient way to document my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants