Polybench® Reference
Selects input bus Sa if the gate is 1, and Sb if the gate is 0, and directs that bus to the output.

Switch Converge


Use this operator to switch two different inputs to one output channel bus, so that either one of the inputs is linked to the output. The switch is controled by the Gate input, which must have 1 channel.

This operator is the counter part of the Switch operator (link).

The Gate input expects a pseudo-boolean signal, which is either around 0 or around 1.

This operator may also be used as a data source selector, where both inputs have completely different data sources.

Operator ports

Input Sa: Any sample type. The connection is not limited to one type of signal.

Input Sb: Any sample type. The connection is not limited to one type of signal.

Input Gate: Floating point values

Output Sa|Sb: Any sample type. The connection is not limited to one type of signal.


Find more information about changing properties here: link

type: Word or phrase
The name of the object in the project. This name must not contain '.' or '$' characters.

Every object has the Caption property. This property is very important, because it is the name by which Polybench recognizes this object.
It is allowed to give multiple objects the same name, as long as the objects are of the same type. In that case, a reference to this caption includes all the objects with the same caption.
In Polybench, every object can be addressed by an Address specifier, which starts with the dollar sign, for example: $My Page.My Object. 'My Page' would be the Caption of a page, and 'My Object' the Caption of an object on that page.

type: See description
Optional documentation of this object.

It is good practice to write in short notes why you have used this object, and why its properties are set the way they are set. If this object is an operator, the Documentation text is displayed below the operator symbol.


The Gate input always functions as scalar. The Gate is connected to only one input channel, which switches all channels from either Sa or Sb to Sa|Sb at the same time.

If the signal on the Gate input is less than 0, the Gate is set to 0. If it is greater than 1, it is set to 1. If the signal value is between 0 and 1, the value is rounded to either 0 or 1.
Therefore it is important to note that the Gate input signal should be a pseudo-digital signal, because if it contains a slow rizing signal, the switch timing is difficult to predict.

Normal mode: counter part of the Switch

The Switch Converge has two different operation modes: normal mode and source selection mode. Which mode is active is determined by the Switch Converge automatically.

In the Normal mode, the signal inputs must be equal of channel configuration, because they must both fit the output channel configuration. This means that number of channels, sample frequency and sample type must be equal on both front inputs. If the operator is switched in this mode, the output configuration does not change; only the origin of the sample stream changes. If the input channel configurations are not compatible, the operator will indicate that it runs in Source Selection mode (see below).

The input signals are however allowed to come from different, unsynchronized data sources! If that is the case, Polybench sees the output as a new data source. So, in that case, the output cannot be mixed with either input anymore, without using a Synchronizer operator (link).

The schematic above shows a typical use of the Switch and Switch Converge, that together form the equivilent of what in other computer languages would be called IF..THEN..ELSE. Using the constant button either the high pass filter is chosen, or the low pass filter.

Source selector mode: select independent data sources

The Switch Converge operator automatically runs in Source Selector mode if both front inputs have different channel configurations. Below the operator symbol 'Source Selector mode!' will be displayed to inform you of its operation.

In this mode, the Switch Converge does not check the input configurations. The output of the operator will have the channels copied from the input that is currently switched on. If the data sources at both front inputs have completely different channel configurations, then if you switch (using the Gate input), the output configuration will change.

The output configuration change that happens when you switch is done in a way that the channels at the output keep their IDs. As a result, channel settings in viewers will not change if you switch.

Beware that this all comes with a prize: in Source Selector mode, switching is a heavy operation. If your data sources force the Switch Converge to use this mode, then you should switch only very seldomly - for example only to let the end-user select a signal source. In Normal mode (described above) switching is very 'cheap', because the output configuration does not have to be changed all the time.
Another hazard during switching in this mode, is that immediately after switching a number of samples from the input source may get lost! This is because the switching may take a few milliseconds in which time no sample data is processed.

Since the Switch Converge can be connected to different data sources without any synchronization, it can be used to switch data sources. You could use this feature, for example, if you make an application with a hardware source and a file replay source, where the file replay source is used for demo or testing purposes, and the hardware source for real operation.


Example: Switch Converge Data Source Demo
Demonstrates that two different data sources can be connected to the Switch Converge without synchronization. Push the button to show data source 1, or release the button to show data source 2.

Example: Switch Converge Disabled Data Source test
Demonstrates that different data sources can be selected using the Switch Converge, also if one of the data sources does not actually run. Press Enable 1 or Enable 2 to stop the sources and then start only one of the sources. By pressing the Push button, you can see that one data source shows a signal, and the other data sources does not put out a signal.