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

Reroute Sound destinations #16

Closed
JohnPaulHarold opened this issue Aug 10, 2016 · 6 comments
Closed

Reroute Sound destinations #16

JohnPaulHarold opened this issue Aug 10, 2016 · 6 comments
Labels

Comments

@JohnPaulHarold
Copy link
Contributor

I have a need to create Sound objects, but send them to a splitter, and then connect the splitter to the context.destination, but I'm not seeing how this can be done currently.

My use case is that I'd like to split the signal of many/some/one Sound object(s), add an analyser to each channel of the splitter, and then connect the splitter to destination. I don't have a need for analysers per Sound object. Is this possible in the current Pizzicato?

@alemangui
Copy link
Owner

Have you tried using the masterVolume node?

This is an undocumented node at the end of the audio graph representing a Pizzicato Sound object.

Image you have a Pz.Sound object with effects called sound and a splitter node called splitter, you could maybe connect the output of the sounds to the splitter doing something like:

sound.masterVolume.connect(splitter);

Then you can connect the different channels of the splitter to analysers.

Your case is interesting. I should think of a way of extending Sound objects in a more natural way and document it. In the meantime try the stuff above and let me know if it helped.

@JohnPaulHarold
Copy link
Contributor Author

That works, thank you.

On your wider point, I was wondering if a Sound object would benefit for a property on the passed options object which defines an override output node. So, by default it routes to context.destination, or the node (splitter, something else), you've defined in the options. This is back of a napkin stuff, and I've done nil tinkering to see if this is workable, but it was rattling around while I hit this issue the other day. It might be too specific a fix for this particular use case.

I'll close this for now, as it resolves my immediate issue. A separate ticket can be raised for extending the Sound object. Else, I can reopen this.

@alemangui
Copy link
Owner

That's an interesting approach.

I currently have a pretty weak way of connecting an analyserNode (via the getAnalyser function). Needless to say, it's not useful when you need to fine-tune the audio graph.

I agree in that a constructor option to specify an array of nodes to connect to (with a default of [Pz.context.destination]) would be considerably more useful.

I will re-open this to keep it in mind.

@alemangui alemangui reopened this Aug 13, 2016
@JohnPaulHarold
Copy link
Contributor Author

this topic was rattling around with me again recently. I was wondering if the concept of grouping Sound objects was useful. A use case would be several drum kit samples, and you want to apply an effect to the grouping, or control gain/mute all sounds in the grouping.

@alemangui
Copy link
Owner

I am currently working on a commit - hopefully over soon - to allow connections between Pizzicato objects and web audio nodes, I think it's quite essential for a web audio library. This would allow to create groups of sounds using splitter and merger nodes - albeit in a rather creative way. I have created PR #23 to track this.

As a separate topic, the idea of grouping sounds had also crossed my mind. I can definitely see the use cases. I will try to envision an API and also create a separate PR for it.

@JohnPaulHarold
Copy link
Contributor Author

JohnPaulHarold commented Sep 28, 2016

just been reading #23, very cool. I thin for now, I'll leave this idea of groupings alone and see what transpires from your connections PR.

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

No branches or pull requests

2 participants