I want to be able to assign an audio signal to a choice of 4 different outputs on my sound card.
It's easy to do with spigot~ but I need to stay in Vanilla for this application.
It's also easy to do by simply sending the audio to all outputs and using [~ 0] on the ones you want turned off and [~ 1] on the one you want turned on. It seems quite a resource-heavy way to achieve a simple thing, is there a simpler way?
-
Assigning audio to different outputs
-
This seems to work.
-
Thanks.... but surely that is going to use even more CPU that a few instances of [~ 0] and [~ 1] Or not?
-
Compared to something like this?
No, I wouldn't think so. That has four separate floating point operations. Catch~/Throw~ likely just passes a pointer around. Not exactly sure how they work internally. You can use pd's loadmeter to test things like this though. Make a gazillion copies and see what the loadmeter says.
(don't make a bunch of copies of the catch~)
edit:: note that making the copies just tells you how well it would scale. I tested with just the four, and they had essentially the same load.
-
Thanks that's very interesting.
My patch has a lot of places where I need to mute a sound and I am doing it with [*~ 0].
Perhaps I will try the throw/catch method.
I wonder if it introduces a delay? My thing is very timing-critical!
Spigot~ is so useful but I need to use vanilla. -
Send and receive~ have a one sample delay but throw~/catch~ don't, if I recall correctly.
I bet both the [throw~]'s set message and the [*~ 1]'s 1/0 message are both computed between blocks. That shouldn't really affect the timing negatively unless you are doing something else during a block and need the change immediately.
In that case... I guess you'd have to use [vline~]. The original message to [vline~] is probably only sent between blocks though too, so you'd have to anticipate when you need the change (maybe by creating a counter with [bang~]).. But I would be surprised if you needed that.
-
Thanks again! Will try everything and see what works best.