Multi-Way Switching in AlsaModularSynth

While creating a patch in AlsaModularSynth I ran into an interesting challenge. I wanted to add a three-way waveform switch (so that I could select the waveform with an external MIDI controller) but I didn’t see an obvious way to do multi-way switching. This post describes how I solved the problem.

First, I created a basic patch using one VCO routed to PCM Out. I used a Mixer in between but that’s optional.


I verified that I could hear the sine wave and then disconnected the cable from VCO Sine.

My next step was to implement a two-way switch between Saw and Rectangle. Here’s a schematic:


The only switch module I found was the VC Switch (on the VCA and Mix menu), which I added to my project. I also added a CV Source module (CVS on the CV Operations menu).

I then made the following connections:

  • VCO Saw to VC Switch In 0
  • VCO Rectangle to VC Switch In 1
  • CV Source CV 0 to VC Switch CV
  • VC Switch Out 0 to Mixer 2 In 0

I right-clicked the CV Source and VC Switch modules to open their respective control windows.


I was now hearing a saw wave. In the CV Source window, I increased the value of the CV 0 slider. Around 0.5 volts the sound changed from a saw wave to a rectangle wave.

In the VC Switch window, I increased the Switch level from 0.5 to 2.5 volts. The transistion between saw and rectangle now occurred at 2.5 volts.

TIP: I used the cursor arrow keys for fine control of the sliders. The up (or right) arrow increases the value; the down (or left) arrow decreases the value. In some cases the control is really fine and I had to hold an arrow key for several seconds before the value changed.

Now I had a two-way switch working, but what I really wanted was a three-way switch between saw, rectangle, and triangle, like this:


That’s not possible because the only switch module is VC Switch and it’s only two-way. However, I found that it’s possible to cascade multiple VC Switch modules to achieve multi-way switching. Here’s a schematic:


The left switch selects either saw or rectangle; the right switch selects either triangle or the output from the left switch.

To implement this, I first disconnected the cable from VC Switch Out 0. I then added another VC Switch and made the following connections:

  • CV Source CV 0 to new VC Switch CV
  • Original VC Switch Out 0 to new VC Switch In 0
  • VCO Triangle to new VC Switch In 1
  • New VC Switch Out 0 to Mixer2 In 0

The CV Source output is in the range 0 through 5 (virtual) volts. Because this is a three-way switch, I split 5 volts into thirds. I set the Switch level to 1.67 volts for the original VC Switch and to 3.33 volts for the new VC Switch.


CV Source CV 0 now selects between the three waveforms. The “trick” is that the two VC switches have overlapping ranges and that the same CV source is used for both VC switches.

Below 1.67 volts the first switch selects the saw waveform and the second switch selects the output of the first switch.

Between 1.67 and 3.33 volts the first switch selects the rectangle waveform and the second switch still selects the output of the first switch.

Above 3.33 volts the second switch selects the triangle waveform and the output of the first switch is ignored.

You can use this concept to create switches with more than three positions; just add an additional VC Switch module for each additional switch position.

Tagged with:
Posted in Instruments

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: