SoftStep Tutorial #3: More Rhythm Sequencing

This tutorial builds on the previous one, to help you get started generating interesting rhythms and rhythmic tonal patterns with SoftStep. If you have not yet done the first part, you should go to Tutorial #2 now.

In Tutorial #2, you created a Pattern16 sequencer driven by a Stepper module, with the pattern number selected with a Step16 sequencer, so we will start with that. Load the .ssp file you created from the last tutorial now. Or you can load the prebuilt file from Tutorial #2, which is "tutorial-02.ssp" in the examples directory. It should look something like this:

Setting Limits

You may have noticed the Stepper and Counter modules count from 0 to 127, then roll over again to 0 and repeat. Even so, the Pattern16 module from this tutorial, and the Knob08 module from the first tutorial worked just fine, going from 0 to 7 (for the Knob08) or 0 to 15 (for the Pattern16) and then cycling around to 0 and repeating. This is because the sequencers simply lop off the part of the step number they don't need. This works fine for step sizes that are evenly devisable into 128 (e.g. 4, 8, 16, 32, 64) although it does not work so well for step sizes that do not (12, 24) as these sizes will have remainders that cause the sequence to bobble once per cycle of 0-127. For this reason, and also because it is sometimes handy to run a sequencer at less than its full step range, modules such as the Stepper and Counter have a Limit setting.

While the your rhythm sequence is running, try changing the Limit input of the Stepper module to something less than 15, say 11. Do this by clicking on the Limit input parameter button of the Stepper module, and selecting "~ 11" from the parameter pop up menu. Notice the Stepper starts counting 0 to 11, and rolling over again; and the Pattern16 module which is being driven by the Stepper now only sequences stages 0-11. Try putting a few other values into the Stepper Limit to get the feel of it, and then set it to 15, so the Stepper counts 0 to 15, 0 to 15, etc. The reason for doing this will become clear in a moment.

Next, we want to set up the Step16 module so it automatically sequences the various rhythm patterns you have set up earlier. We are going to use a Counter module to do this, but instead of clocking it with a Clock module as we did in the first tutorial, we will use the 0-15 cycle of the Stepper module (which is driving the Pattern16), so we get a new Pattern16 rhythm pattern every time it cycles through its 16 steps.

Pattern Stepping

Create a Counter module, by selecting it from the Clocks submenu. Connect the Counter module's Clock input to the Stepper-1. You should now see the Counter module's output value incrementing every time the Pattern16 cycles a full pattern. This works because the Clock input of the Counter module is looking for a gate, a 0 to non zero transition. Since the Stepper module is now counting 0-15, the transition from 0 to 1 causes a count, and then all further non zero input is ignored - until once again there is a zero to non zero transition.

Earlier you had set up some patterns in the Pattern16, and then you set these pattern numbers into some of the stages of the Step16, so you could switch among them. Now you are ready to do this switching automatically. Set the Counter module's Limit input to whatever number that is equal to the highest stage of the Step16 that has patterns in it. For example, the patch shown at the top of this page has 3 patterns, 0 in stage 0, 1 in stage 1, and 2 in stage 2 - all the other stages of the Step16 are empty (0). So with this example you would set the Counter Limit to 2 to count 0, 1, 2, 0, 1, 2, 0, etc.

Finally, connect its Stage select input to the Counter module. You should now see and hear the Pattern module stepping through its rhythm patterns.

Take a few moments now to experiment with this patch. Change the pattern buttons, change the Counter Limit to step through more or fewer patterns, change the Stepper Limit to sequence different numbers of rhythm beats per cycle, change the Number module that controls the overall Stepper speed, try different Program Change values in the MIDI get the idea.

Refining the Patch

By now you probably have noticed that the Pattern16 module changes patterns on stage 1, not stage 0 as you would expect. This is because the Counter module is being driven by the Stepper module's transition from 0 to 1; in order to start the pattern change at step 0, the transition would have to be on the Stepper's 0, not 1. The fix is a very simple logic module that turns all not zero values to zero, and all zero values to not zero (127). It is the NOT module from the Logic submenu. Create it now, and connect its input to the Stepper-1.

Notice the LED of the NOT module flashes at the same time as the Pattern16 stage 0 LED. Connect the Counter-1 Clock input to the NOT, replacing the Stepper-1 connection. Now the Pattern-1 will switch patterns at stage 0 rather than stage 1.

But wait! Now there is a new problem, a little burble at the time of the switch over. That pesky 1-tick timing error we ran into with the classic analog patch at the start tutorial #2. These kinds of timing problems are generally easily fixed, but you do have to take a moment to analyze what is causing the problem, and then apply the fix with laser, not sledge hammer, accuracy.

A Primer on Processing

The 1-tick timing problems arises because SoftStep does not process its modules all the time. Rather, it sets a 1-tick timer, processes all the modules and then goes to sleep until the timer fires, at which time SoftStep wakes up, resets its personal alarm clock, processes the modules, and goes back to sleep again, etc. The reason SoftStep is sleeping all this time so it can co exist with other Windows programs, and give the more CPU intensive software such as softsynths the lion's share of CPU resources. The cost of this cooperation with other MIDI and Audio programs is that once in a while you have to deal with processes that get out of sync with SoftStep's process/sleep/process cycles.

To minimize these 1-tick errors, SoftStep modules are processed in a particular order regardless of the order in which you create them. Clocks and timing critical modules are processed first, then sequencers, then other processing, and MIDI output modules are processed last. The general processing order is the order in which the modules appear in the menu - so when you are trying to figure out which module gets processed when, just look at the Modules menu order.

Fixing the Glitch

Back to our specific problem. Everything worked fine until the NOT module was put in place, at which time the Pattern16 module starts being off by 1 tick. The processing chain of modules we are interested in is:

    Stepper-1 > NOT > Counter-1 > Step16 > Pattern-1 -> MIDI

Check the menu order and you will see that the modules all are in the same order here as they are in the menu, with the one exception of the NOT module, which comes after the Counter module, not before it. So what is actually happening is:

    1. Stepper-1 is processed and posts its results for any other module to use.
    2. Counter-1 reads the output of the NOT, processes accordingly, and posts its results
    3. NOT reads the Stepper-1 output, processes it and posts its results
    4. Step16 reads the Counter-1 posting, which had processed its results before the NOT.

So Step16 is always getting yesterday's news from Counter-1. The remedy is to force the modules to process in the correct logic flow order. For this, modules have the Priority Button, which is the top left button with the number 2 (which is the default priority the module was set to when created).

To fix our little timing glitch, click on the priority button of the NOT module and change it to Priority 1. Do the same for the module that feeds it, the Stepper-1 module. This will result in the Stepper and NOT being processed first, and the other modules thereafter - which puts the modules in the correct processing order, and removes the glitch.

Save your work so far, and take a break. You've earned it! When you are ready, continue with Tutorial #4, which will add additional voices, and give you the foundation for a small but complete rhythm ensemble.

How it looks so far:

SoftStep is Copyright © 1999-2004 by John Dunn and Algorithmic Arts. All Rights Reserved.