Array Sequencers

In the previous memory sequencer patch, instead of using the HMeter to monitor the RoStep progress, there is a cooler way. Use Load Macro in the module pop up menu to fetch a 16LED macro from the Macro/Examples directory, and replace the HMeter with it. Here is how it looks:

Download this patch

If you look inside the 16LED macro (by clicking on its "@" button), you will see two modules using the same Array, the AChgWrite array sequencer, and the LedGrid widget that draws the row of 16 LEDS:

Array sequencers use ArtWonk arrays for their stage memory storage, rather than having private memory attached to the module. This allows modules to share their sequence memory, making Arrays the best choice when you need to access the same sequence with multiple modules.

While the LedGrid module is a widget, not a sequencer, it uses an array to hold its values. When first created or loaded it allocates an unused array for its values, just as if it had a built in AryNumber module (which in fact it does). The array size will be its Rows times Columns. The array number is "published" in the Ary# output, so modules like the AChgWrite can access the values.

The AChgWrite module is a versatile read/write sequencer, that writes when its WChg input changes. The XWrit ("Exclusive Write)" input is a flag that causes the value at the previous address to be erased as it writes (the WVal input, 1 ) to the current address. The address written to is the 16LEDs Step input (which appears as an output here inside the macro). So at every step, the step index is set to 1, and the previous step is erased (set to "0"), thus causing the LED to turn on at the Step address and the LED at the previous address to turn off.

Drum Pattern Sequencer

Rather than build a patch, for this tutorial we will closely examine an existing macro patch. This will be the Drum3x macro, included in the Macro/Examples directory, which shows how to extend the LedGrid to make a drum pattern sequencer:

1. To see this macro in action, starting with a New Workspace, create a Stepper from the Clock group, then fetch a Drum3x macro with Load Macro. Connect the output of the Stepper to the input of the Drum3x, and you should see the top row of LEDs step, and the 3 yellow LEDs to the right, that show the pattern at the current step, should flash in sync to the 3 outputs of the macro module.

Note that the macro has a green ball icon, which means the modules inside only execute when the input changes. So while you are examining the macro, it will be helpful to leave the Stepper connected and running. Otherwise when you are inside the macro it will appear to be frozen.

2. Go inside the macro by clicking on the "@" button, and you will see a patch similar to LedGrid, above, but somewhat extended:

Here, there are two arrays. One (AChgWrite) for the status LEDs along the top and another (AMultiTap) for the 3 rows of the drum pattern sequencer.

Perhaps the best way to understand this patch (and most other patches) is to use the label highlighters to follow the signal flow. Since this is a macro, signal flow will likely start and end with the Self module.

3. The macro has only one input, Step, which appears as an output on the Self module. Click on the label (not the output box, just the label), and it will highlight blue, and you will see its destination, the In input to the IMod module highlights yellow. This tells you that the input value is going to only one place, the IMod.

4. Click on the bottom input to the IMod, the /In. It will highlight pink, and you will see its source connection, Cols of LedGrid F highlight yellow. So the IMod is running a modulus, or remainder, operation on the input, with a dividend of 24, the number of columns in the LedGrid.

The purpose of the IMod is to roll over the input value to the number of stages. So even though you are sending an input that goes from 0-127 (the default Limit of the Stepper module feeding the macro input), the module steps from 0-23.

5. Click on the Out output label of the IMod to see what modules it feeds. You will see it goes to 4 different modules, the two add modules, Add and Addx; and the two array sequencer modules, AChgWrite and AMultiTap.

6. Since we are familiar with the LedGrid - AChgWrite combination from the 16LED macro we viewed first, we will start with that. Again, the LedGrid has set up an array for its values and published the array number in its Ary# output, which the AChgWrite receives in its Ary# input.

The IMod output connects to both the WAdr and WChg inputs to the AChgWrite, so every time the value steps AChgWrite gets a new write address and a "change" signal that tells it to write. Both the WVal (value to write) and XWrite (exclusive write) are set to 1, causing it to write 1 at each new index, and to erase (write 0) at each previous index. The AChgWrite Addr (read address) and Out output are unused because the LedGrid module will scan the entire array as its input.

7. Click on the blue ("F") properties button of the LedGrid module that is just below the AChgWrite, to get the LedGrid properties pop up:

Notice the number of columns is set to 24 by the top slider. This macro is set up so there are no hard coded values that would cause problems by changing the number of columns. So you can easily change the number of steps simply by changing this slider and the one in the other LedGrid module, that controls the drum tracks.

Also notice the Display Only option at the bottom center is checked. When not checked, clicking on a LED will flip it from on to off or vice versa. This will be what we want in the drum tracks, but not here.

Finally, notice the 2nd Color box is set to 4. This is what causes every 4th LED to be a different color. When set to 0 this feature is turned off.

8. Click the Cancel button to exit the properties pop up, then click on the blue ("H") properties button of the 2nd LedGrid module, just under the AMultiTap module:

Notice the Rows slider along the left edge is set to 3, giving 3 rows of drum tracks. Also the Display Only check box is not checked, so clicking on these drum track LEDs will turn them on or off. Which is the point. Click Cancel to exit the Properties pop up.

9. The AMultiTap is the same as the ARoRanAdr, except it has multiple read address/value output pairs. For each Adr input, a corresponding output contains the value at the given index address. You can change the number of addresses to read from with the "#Taps" control in the lower left of the module's Properties button, which you would need to do if you wanted to add more drum tracks. For now, we will leave it at 3.

Since there are 3 rows of LEDs, the memory array that holds the LED on/off values is 3 rows x 24 columns, or 72 array elements, numbered 0-71. The LedGrid Max output shows 71, the max array element. There is also a 73rd array element at address 72, which contains the index last clicked by the mouse. This is essentially a built in Latest module. It is useful for selecting the current element, and you can see it used in two different ways in the 16SldSeq macro and the TestExOnButtons patch in the respective Examples directories. But for this patch it is unused. We only need to parse the single 0-71 array into 3 separate 0-23 arrays, and for this we use the two Add modules.

10. Click on the label (not the input box) to the Adr1 input of the AMultiTap module. You will see that it is connected to the IMod output, same as the AChgWrite WAdr and WChg inputs. This will give the 1st row address values of 0-23. For the 2nd row, the addresses will be 0-23 starting at offset 24, or 24-47. Click on the AMultiTap Adr2 label and you will see that its input is connected to the Add module output.

11. Click on the In 1 label of the Add module to see that this input is connected to the IMod module right above it. So this gives the 0-23 part. Click on the Add module In 2 label and you will see it is connected to the Cols output of the LedGrid, to give the offset of 24. By using the Cols output instead of simply typing 24 into the input, the macro is able to automatically update the offset if the number of columns is changed, as mentioned earlier.

12. Back to the AMultiTap module, click on the label of the 3rd tap, Adr3, to see it is connected to the Addx module. This module adds any number of inputs, which you can set with the module's Properties pop up. In this case it is adding 3 inputs, the step address, 0-23 from the IMod, and the Cols x2 from the LedGrid, giving an offset of 48 for an address range of 48-71.

Thus, the three outputs of the AMultiTap are the gist of this macro, the clock-like on/off values that reflect the on/off state of the 3 rows of drum track LEDs. These outputs are connected to the Self module's 3 output inputs, and also to the 3 floating yellow output indicator LEDs.

Finally, as sort of a graduate course for this tutorial, take a look at another similar macro, DrumVal3. This adds analog-like slider inputs to each of the drum stages. It turns out that the heavy lifting has already been done, so adding the sliders is simply a matter of adding two modules to the patch, the ASliders which is similar in concept to the LedGrid, and another AMultiTap set up about the same as the one for the LedGrid.

To use either of these macros in a music producing patch, you only need to add 3 MIDIVoice modules, or 1 MIDIVoice and 2 Note Out modules if you are using the same MIDI channel for all three voices. Since this is a drum track patch, you may be able to use MIDI channel 9, the drum channel for General MIDI and most sound cards, and select each drum instrument with the Note inputs while playing the beat with the Clock inputs.

Since these macros are set to run only on a change at the input, and since the array sequencers and widgets are very efficient anyway, you can easily stack up several different drum patterns without bogging down your computer. Then by using Relay, Switch and other sequencer modules to switch among them, you can achieve monster polyrhythms that are both complex and highly controllable.

[Introduction Sequencer Memory Sequencer Stepping]

[Return to Tutorial Page]