This partial DSP graph is a construct I find myself using over and over. It is used extensively in Accents. For example in the Voltage Vault unit for the bypass switch, in Logics & Maths for switching between the different algorithms, and probably many other places.
I thought I’d document it for myself so I don’t have to re-understand it each time, and also for anyone who it might help in their middle or UI layer endeavors.
In the example below, we are switching between sending the unit input, and a signal called mySignal to the unit output by engaging or disengaging a toggle control (comparator) called switch
. It should be relatively easy to adapt this concept to switch between any two signals, and also to use other mechanisms to switch between them - for example an item in the menu which performs a hardSet
operation.
Switch (Comparator) is off (zero) - mySignal sent to unit output
The invertingVCA multiplies the output of switch
(0) by negOne
(-1) for a result of 0. This is sent to switchSum
, which adds one (1) to it for a result of 1. This is sent to mySignalToOutVCA
and multiplied by mySignal
. mySignal
x 1 = mySignal
. Finally this is sent to outputMixer
, and then to self,“Out”. The result is that mySignal comes out of the unit output.
Following the other path for self,“In”, it is fed to inputToOutVCA
where it is multiplied by switch
, who’s value is zero, resulting in silence sent to the outputMixer
and to self,“Out”. The unit input signal is silenced (0) in the outputMixer
.
Switch (Comparator) is on (one) - unit input sent to unit output
The invertingVCA multiplies the output of switch
(1) by negOne
(-1) for a result of -1. This is sent to switchSum
, which adds one (1) to it for a result of 0. This is sent to mySignalToOutVCA
and multiplied by mySignal
which results in zero (silence mySignal). Finally this silent signal is sent to outputMixer
, and then to self,“Out”. The result is that mySignal is not heard on the unit output.
Following the other path for self,“In”, it is fed to inputToOutVCA
where it is multiplied by switch
, who’s value is 1, resulting in mySignal appearing on the outputMixer
and to self,“Out”. The unit input signal is sent to the unit output.
local inputToOutVCA = self:addObject("inputToOutVCA",app.Multiply())
local mySignalToOutVCA = self:addObject("mySignalToOutVCA",app.Multiply())
local outputMixer = self:addObject("outputMixer",app.Sum())
local switch = self:addObject("switch",app.Comparator())
local invertingVCA = self:addObject("invertingVCA",app.Multiply())
local negOne = self:addObject("negOne",app.ConstantOffset())
local one = self:addObject("one",app.ConstantOffset())
local switchSum = self:addObject("switchSum",app.Sum())
switch:setToggleMode()
negOne:hardSet("Offset",-1.0)
one:hardSet("Offset",1.0)
self:addMonoBranch("switch", switch, "In", switch, "Out")
connect(mySignal,"Out",mySignalToOutVCA,"Left")
connect(negOne,"Out",invertingVCA,"Left")
connect(switch,"Out",invertingVCA,"Right")
connect(invertingVCA,"Out",switchSum,"Left")
connect(one,"Out",switchSum,"Right")
connect(switchSum,"Out",mySignalToOutVCA,"Right")
connect(mySignalToOutVCA,"Out",outputMixer,"Left")
connect(self,"In1",inputToOutVCA,"Left") --
connect(switch,"Out",inputToOutVCA,"Right")
connect(inputToOutVCA,"Out",outputMixer,"Right")
connect(outputMixer,"Out",self,"Out1")
-- ...
controls.switch = Gate {
button = "switch",
description = "switch",
branch = branches.switch,
comparator = objects.switch,
}
@odevices what do you think about a tag called “development”?