In this third tutorial, we examine the StepSequencer and how it can be thought of as one big, resource-rich automated MIDI keyboard.

Before beginning this Tutorial B, please download the Kyma Tutorial Sound file that contains the Sounds discussed below. Completion of Tutorial A, Part 1 and Tutorial A, Part 2 is highly recommended.

I would welcome feedback on these tutorials to enable me to make them even more clear than they are. I have set up a special email account to handle these communications at:

Barton McLean, 1/13/16

Each section refers to a correspondingly-named Sound found in this tutorial’s Sound file.



In order to understand the basic principles of the StepSequencer, one must first look at the traditional MIDI Keyboard and how it controls Sounds, because the StepSequencer is really an automated MIDI Keyboard in its basic operation.

[If you do not have a MIDI keyboard, you can go to the Tools menu and select Fake Keyboard. This allows you to test the KeyEvents even when no keyboard is attached. (You can alternatively use the eraser end of a Wacom tablet pen, or Kyma Control on the iPad).]

Open the Sound file Bart’s Kyma Tutorial #B – The StepSequencer.kym and look at the first example, 1. StepSequencer Introduction: Similarity with MIDI Keyboard. Here we have a typical MIDIVoice Sound:

Screen Shot 2016-01-14 at 10.25.24 AM

First, play the Sound; then play some keys on a MIDI keyboard. Note that none of the hot values in the sample are found in the VCS (there is an output volume widget but this is from the MIDIVoice, which will later be replaced, so is not relevant). Thus, you have established the three main components of not only the MIDI keyboard, but also of the StepSequencer.

Each KeyEvent has three (optionally four) components:

  1. !KeyDown
  2. !KeyPitch or !KeyNumber
  3. !KeyVelocity
  4. and, optionally !KeyTimbre

!KeyDown is the gate that initiates the event and the other 3 (or 4) elements control the parameters of that event.

TASK # 1: Before attempting the sequencer, find the ADSR Drag&Drop Sound from the prototypes and drag it just to the left of the MIDIVoice Sound (be sure not to drop it over the + sign with a circle).

Note that there is a !KeyVelocity in the ADSR’s Scale parameter field (parameter fields are those green boxes in the side bar to the right of the signal flow graph — not the VCS — with titles such as DurationsKeyPitches, etc.); !KeyVelocity is one of the three KeyEvent controls necessary to make this entire Sound make sound (the other two are found in the Sample).

Again play the keyboard (every time you make a change in the Sound as you just did, you need to select the rightmost Sound module and press the space bar to play), playing the MIDI keyboard with varying velocities and note the difference in sound level.

TASK #2: Find and drag the StepSequencer from the Prototypes into the Sound by placing it directly over the MIDIVoice and selecting “Replace.” At all times, the sequencer must be placed to the RIGHT of anything it is supposed to control. Play the Sound by selecting the right-most icon and pressing the space bar.

PRELIMINARY HOUSECLEANING: When the VCS pops up (if there is no VCS present when Sound is played, go to the File menu at the top and select Virtual control surface). If you cannot see everything in the VCS, notice the square box at the top of the VCS in its middle. Part of it is blue (the part you are seeing) and part is white. Click and drag the blue portion to scroll within the VCS.

TASK #3: In the VCS, click the blue portion and pull it down or sidewise, revealing the rest of the VCS widgets. To do a quick gathering of all the widgets in the visible window, go to the gear menu residing in a small box toward the upper right of the VCS. Select Automatically resize widgets… and voila, all the widgets now appear in the window for you to see.

TASK#4: In order to hear the playback, you will need to click on one or more of the buttons labeled sw01, sw02, etc. In order to get more than one pitch, you will need to change the P01, P02, etc. faders. When you have something you like, save as the default preset (Ctrl+click on the camera button at the upper left to overwrite the existing default preset).

Take a peek at the various parameter fields in the StepSequencer to see how they work. Kinda complicated, huh? Right. So we’ll save this for another day and go on to the next tutorial, which is basically the same but with vastly simplified hot values and parameter fields in the sequencer.

Notice that the hot values in the parameters of the Sounds on the receiving end (Sample and ADSR) not only have not changed between this Sound and the MIDI keyboard of the last tutorial, but also, they will not change in the next tutorial either. These are !KeyPitch (or !KeyNumber nn), !KeyDown, and !KeyVelocity. Find where these are.

Note that the Scale parameter in the Sample is at 1, where the similar scale parameter in the ADSR has the hot value !KeyVelocity. Both concern output level but only one has the controlling hot value. Why is that? Think of the ADSR Drag&Drop combination as the faucet opening and shutting the Sample’s sound output.

Conclusion — the sequencer acts very much like an automated MIDI keyboard, with the same hot values. You might also think of the sequencer as a radio transmitter which broadcast lots of stuff, and the Sample and ADSR as a radio that tunes in ONLY those parameters that pertain to it specifically. These hot value “Stations” are !KeyDown, !KeyNumber or !KeyPitch, and !KeyVelocity. These MUST be present in the recipient Sounds if you want the sequencer to control those Sounds.

Notice also that I have elongated the Stage widget, which is a radio button reflecting the GeneratedIndex parameter field of the StepSequencer.


The Sample is at a scale value of 1, not !KeyVelocity, because its sound must go directly into the Product Sound (which is here labeled ADSR Drag&Drop — don’t be confused with these arbitrary labels and the actual name [or class] of the Sound itself, which here is Product) at full volume to interact with the ADSR Drag&Drop, which acts as the faucet cutting off and shaping its level.

The Product acts as the traditional voltage controlled amplifier in analog electronic music, with a control input (ADSR) and audio input (Sample). Double-click the Product and hover the mouse over its description at the top to confirm this. In fact, in all these tutorials is would be good to develop the habit of mouse hovering over parameter fields and Sound descriptions. Lots of good information there.


This is a simplified version of the StepSequencer compared with the last one.

The main point here is to show the close relationship between the sequencer and the traditional MIDI keyboard, which you have already worked with. The StepSequencer has 3 main functions: pitch, volume, and tempo. In order for the sequencer to work, it has to have certain criteria at the sequencer end, and other criteria at the receiving end (in this case, the Sample and ADSR). Click on the StepSequencer and mouse over some of the parameter field headings.

THE RECIPIENT END MODULES (SAMPLE AND ADSR HERE) have, in their own pitch, volume, and tempo parameters, no change from when you were controlling them with the keyboard:

  • Pitch: !KeyNumber nn
  • Volume: is at 1 for now, and so all the heavy lifting for volume is in the ADSR with !KeyVelocity
  • Tempo: is simply seen as the rate of !KeyDown triggering

(There are other parameters too, but one gulp at a time.) These three are exactly the same recipient controls as for the MIDI keyboard. And so you can think of the sequencer as basically an automated keyboard.

Incidentally, these three hot values placed in their respective recipient parameter fields are special in that the exact names (or a few others that do the same job) must be present in the recipient parameter fields in order for the sequencer to control the Sound.

For example, if the recipient ADSR gate field had the very common  1 bpm: !BPM expression, the StepSequencer would not gate the ADSR. The Sample would be triggered at the !BPM tempo, but the pitches would not be coordinated with the triggers. Only !KeyDown will receive the StepSequencer triggers in the recipient gate field. Instead, save the !BPM to put in the StepSequencer Rate parameter field, where it will control the overall tempo of everything it gates.

THE STEPSEQUENCER HOT VALUES: Whereas you just looked at the recipient areas, now you are going to look at the sending area — the StepSequencer itself. Before proceeding, please mouse over each parameter field in the sequencer to see what it does and what values it must include.

KEY PITCHES: If there are just single hot values, such as the !P1, !P2, etc., they can exist without curly brackets. If you want 8 notes in the sequence, then put 8 hot values in this field, with a space and not a comma (the same pertains to other fields, such as Durations, DutyCycles, KeyVelocities, etc., but, for now, it is not necessary to have anything but one single number or hot value in these). As for the specific names to use, they can be anything so long as they have the ! in front. However, if you are using expressions (such as {!P1 + !Transpose} {!P2 + !Transpose} … ), these need to be within curly braces.

When you play the sequence, in the Sample the !KeyNumber nn will automatically receive the !P1 … notes, just as the !KeyNumber nn would do if you were playing the keyboard.

The other hot values compatible with the StepSequencer in the Sample’s frequency field are !Pitch nn and !KeyPitch nn. The “nn” is not part of the necessary hot value, but is included to make sure the values are interpreted as the “note numbers” of the MIDI keyboard.

DURATIONS AND RATE: These are inextricably linked. Play the StepSequencer and change !Durations and !BPM in the VCS to see how they relate. Mouse over Durations and Rate in the parameter fields to see info on them. The VCS will not show “Rate,” but rather will display the hot value !BPM from the expression in the Rate parameter, !BPM/60. In other words, the parameter field headings in the StepSequencer (or any other Sound) may or may not show up in the VCS, depending on whether or not the hot values used in the parameters are identical to their parameter field names.

DUTY CYCLE: Works the same as before.

KEY VELOCITY: Usually used to control volume. Often this has its own sequence of hot values, set in the VCS from 0 to 1, or set as on/off switches. Here it is just set to maximum (1).

START & END INDEX: Here they are always set to play the whole sequence of 8 notes from 0 to 7 (not 1 to 8). Often their respective hot values can be used in the VCS to change sequence start and end stages.

Here is a brief map of the critical areas between sender “transmitter” (StepSequencer) and recipient “radio receiver” (Sample and ADSR) as pertains to this tutorial:

KEY PITCHES!P1 !P2 !P3 …!KeyNumber nn
RATE & DURATIONS!BPM/60 & !Durations!KeyDown
DUTY CYCLES!DutyCycleHas no specific equivalent

Experiment with various combinations to try to get a sense of what each VCS widget does in this StepSequencer. There is no answer equivalent to this since it is instructional only.


You will be taking the next Sound — 3. Shamelessly stealing sequencer expressions from other Sounds — (which is a copy of the Sound from the previous section), going to other existing StepSequencers in the Prototypes or Sound Library areas, and copying/pasting their expressions into this one and see what happens.

Before you do, note that, although you will be changing the expressions at the sequencer end, we will not be changing the recipient Sounds (Sample, ADSR), which should pretty much either remain the same, or have other hot values or numbers supplementing (but not replacing) them. The most common problem with beginners not getting sequencer results lies in this area — not including some version of !KeyNumber or !KeyPitch, !KeyDown, or !KeyVelocity in the appropriate recipient parameter fields (!KeyDown in the Gate fields of Sample, ADSR; !KeyNumber in Frequency field of Sample, and !KeyVelocity in Scale field of ADSR and/or Sample).

Where to find these more exotic and often more elegant and useful expressions to add to your sequencer repertoire? Three ways: as in all other Sounds, you can

  1. place your mouse cursor anywhere in a StepSequencer parameter field and click/activate it (parameter fields are those green boxes in the Sound itself — not the VCS — with titles such as Durations, KeyPitches, etc.) and then click on the yellow circle “i” at the lower right corner of the window, thereby calling up a host of very, very exotic and sometimes (as yet) unfathomable expressions
  2. go to the Expressions Library in the Kyma 7 Sound Browser and activate the triangles twice, exposing the sequences.txt file, opening up a world of simpler and easier understood expressions with comments (drag or copy the expression to the parameter field)
  3. or — my very favorite method which involves a bit of petty theft — finding an existing sequence you really like from the Prototypes, or from the Kyma Sound Library in a folder called Scripts, constructors, sequencers & composition, and copying/pasting an expression between identical parameter fields (such as the KeyPitches field in both sequencers).

This last way is what this tutorial is all about.

Tip: Once you have a StepSequencer (or anything else) selected in the Prototypes, try this trick: Under the Info menu select Examples. This opens a Sound Browser full of sequencer examples!


TASK #1: Find and open the StepSequencer in the Prototypes (search via Ctrl+B). Play it (always play from the rightmost icon no matter what it is). Note the row of sw buttons. These are toggle widgets that display the steps as either “on” or “off.” So, in the StepSequencer Sound (not the VCS), copy the contents of the KeyDowns parameter field from this prototype and paste it into the same parameter field in the tutorial Sound, playing the new Sound while turning various steps on and off. Reminder: Use the VCS gear menu to bring all widgets into view by selecting Automatically resize widgets…

Before finishing, turn all 8 sw buttons on and save the VCS settings as the default preset.


TASK #2: Using the StepSequencer prototype, first experiment with the Velocity rotary faders while playing the Sound, achieving a different volume level for each step. Now find the KeyVelocities parameter field in this prototype Sound and copy everything in it. Paste it into the corresponding field in your tutorial Sound.

When you play the Sound, you might see that the rotary faders in the prototype have been converted to ordinary faders in the tutorial. No matter. They perform the same job albeit taking a bit more room.

Adjust the various velocity levels to achieve a variety of volumes.

TASK #3: Open the VCS editor and click on one of these velocity faders. The key to understanding here are the values found in the Widget Type and the Min/Max/Grid edit fields of the VCS Editor. Experiment with different widget types and see what happens.

For example, select Velocity02, which is a basic fader with the number showing. Now experiment with different volume settings and discover that, with the widget type of Fader, a whole range of volume levels becomes possible.

Now change the widget type to Toggle. Then reduce the height of the widget to form a horizontal box. Finally, in the Min/Max/Grid fields, change the Grid from 0 to 1. As you play it now, with all other velocity faders turned to 0, it will sound at full volume as you toggle it on and off with the mouse.

Whether or not this widget is a continuously variable one, then, is simply a function of (1) what kind of widget you want to make it, and (2) what value and grid you assign to that widget.

Before going on, return Velocity02 to its former state, joining the others.


TASK #4: Play the same StepSequencer Prototype example and determine what happens when the !Swing widget is moved in the VCS.

Copy this Durations parameter field expression and paste it into your tutorial Durations parameter field. Play your sequence. Mouse over the Durations parameter field title to read what it does.

Note that every pair of notes is identical, and whenever the first note of the pair is altered, the second note is altered in the opposite way so as to not affect the overall tempo, but rather to affect the pair relationship. Note also that it is an expression, not a single hot value, and as such, with this and other parameter fields in the StepSequencer, each note must be enclosed with curly braces

[Curly braces are needed in certain types of parameter fields, such as this Durations field which expects an ARRAY of duration values, rather than a single value. Curly braces indicate that whatever is inside the curly braces should be viewed as a single value. When you enter an expression in the Durations field, place curly braces around the expression to indicate that it is the RESULT of the expression that should be viewed as a single element of that array.]

As with all such operations in the future, save this as the default preset in the VCS and save the Sound itself before proceeding.

DUTY CYCLE — Use of Capytalk messages and using a single expression enclosed with curly braces:

TASK #5: Still from the same Prototype StepSequencer, copy and paste from the DutyCycles parameter field.

Being an expression rather than a single hot value, this also needs to be enclosed in curly braces. Its function is to take the duty cycle and tie it directly to the tempo (!BPM, also seen in the Rate parameter field). The faster the tempo, the shorter the note, and vice versa.

This has two Capytalk messages (those purple text thingees which often are followed by a colon, meaning they have to have a qualifier value to proceed). Under the Help menu select Capytalk Reference, search for these messages by typing in part of each message in turn, and see what they do. You don’t need to understand everything, but you can get a general sense of what they do.

As in so many cases, just copy/paste from one Sound’s identically labeled parameter field to another will suffice without understanding completely every single aspect of an expression. In this case, the duty cycle is tied in with the !Legato hot value.


TASK #6: As you can see, these indexes are fixed in the tutorial as 0 and 7, making 8 steps. Make them simple hot values by typing a ! in each parameter field and allowing it to automatically fill in the rest of the text. Then, as always when you make a change in a parameter field and go to play the Sound, the VCS will open and you can unlock its VCS editor and arrange the location, type, and size of the widget, and enter the range of its values in boxes found in the middle of the editor.

In this case, edit the widgets StartIndex and EndIndex so you can change their min/max values to 0 and 7 (respectively) with a grid of 1; the grid will give you discrete steps (rather than a continuous fader which would have a grid of 0).

In the VCS when you play them, experiment with different start and end index values. Do not be confused between !Start and !End, which pertain to the where in the Sample the sound begins, and !StartIndex and !EndIndex, which pertain to the steps in the StepSequencer.


TASK #7: Unlike other gates you have used which gate the Sound itself like a faucet, this one turns on and off the StepSequencer itself. Once you have started the sequence, if you then give the gate a value of 0, the StepSequencer will finish its run and then stop.

As you look at it before we change it, it is now at a value of 1, which means it will loop forever. All gates are either 0 (meaning off) or a positive value (usually 1, meaning on). Replace this 1 with a hot value (for example, !SeqOnOff) and in the VCS, turn this into a check box so you can manually turn the sequencer on and off at will. As before, make the appropriate adjustments in the VCS for fader type, size, and value.

TASK #8: Finish up by arranging all the widgets in the VCS by function and step. Then assign arbitrary colors to each function, making everything clearer.
With color, or anything else, you first need to select one or more widgets, then go to the Options menu in the editor and select Label color.

Proceed to the Tutorial #3: Answers, where your arrangements may be somewhat different. As long as they broadly conform to grouping together as function, and existing from left to right mirroring the icon diagram, they will be fine.


A new EventValue has been added, namely to the GeneratedIndex parameter field in the StepSequencer. With the !Stage hot value, I made it a Radio button (fill) widget in the VCS, with values from 0 to 7 and a grid of 1. Radio buttons are useful (among other uses) whenever you have a widget that displays, rather than causes, events. I have also colored each section according to its function. Much of this is arbitrary of course.

Try both presets. Note in the second one, the value of the End fader is very small (0.12676), producing a double note on the highest pitch (since the Sample is looping, and when !End is that small and the pitch is that high, the Sample has time to loop twice during the duration of the note).


This is a simplified version of #3 (Answers). We will work with some randomness in the KeyPitches field, replacing the existing data. We have removed the sequencer gate hot value since it interfered with the rest of the sequencer operation (the gate, which starts and provides for one complete run or continuous run of the sequencer, has less meaning when the pitch order is randomized).


TASK #1: At the top of the Sound Browser, select Sound name from the search criteria and type “Random order” in the Search field. Find and select Random Order SequenceKBD from within the search results and play it.

Note that there are 8 fixed pitches but their order is random. Open the Sound (by double-clicking) and look at the KeyPitches parameter field; note that at the end of the expression, there is an array of the 8 pitches indicated as hot values, and that the rounded message converts each !SmallInterval value to a whole number allowing equal-tempered half steps. The nextRandom message provides the random number and the abs message makes every value a positive number. Most of the rest of the expression has to do with coordinating pitch change with sequencer rate and duration. No need to completely understand it to use it. In this case, the parentheses combine with curly braces in a fairly complex way. [There are curly braces around the entire Smalltalk expression, and there are curly braces around each element of the Array.]

As before, copy this expression and paste it into the identical parameter field in this tutorial (KeyPitches). Then play the tutorial to see how it works. Adjust the eight pitches to form a group of notes that you like, and save this as the default preset in the VCS.


TASK #2: We have left the sequencer StartIndex and EndIndex parameter values intact. Even though they now have no effect on the pitch order, you will notice that, although the pitches are random, the order of on/off switches as seen in the KeyVelocities field, and visualized in the VCS as switches, still retains its order, since the switches have not been randomized as have the pitches.

Also play with these as applied to changing !Swing. Many interesting and unforeseen rhythmic patterns result.


TASK #3: Now, look at the tempo, as seen in the Rate parameter field.

Click in the Rate field after the 60 so the insertion point is just after the number. Next, copy the LFO (low frequency oscillator) in the Prototypes and paste it into the Rate parameter field at the end of the expression and click Accept.

OOPS — Something wrong. You get the error message, “Nothing more expected ->”. Why is this?

Beacuase you cannot have two values beside each other in a parameter field without inserting an arithmetic operation between them. For example, you could add a + or a * between them, signifying adding or multiplication.

Try both in turn and see what happens.

The expression in the Rate parameter field has 2 parts: !BPM/60 followed by the yellow-colored LFO Sound. For example, if !BPM has a value of 120, and you are dividing by 60, the Rate value is 2. If you multiply this by the LFO, and its !Modulation is at 0 (remember !Modulation is the output level of the LFO), then 0 times 2 = 0 which “freezes” the sequencer at its current stage. So either you should make sure !Modulation is not set to zero or you could try adding the two parts together instead.

Adding is my preferred way to get what I wanted: a slightly time-varying beat that slows down or speeds up according to the frequency of the LFO (and its !Modulation level). Once you’ve added the plus (+) symbol, accept the Sound (click Accept at the lower left of the parameter fields part of the editor), and you will see the LFO pop out in the Sound diagram.

Open it and take its frequency, which is tied to !BPM, and substitute a simple hot value instead, say, !LFOFreq hz (with a space between !LFOFreq and “hz”, it should turn purple). !LFOFreq will have the standard 0 – 1 value in the VCS. Note that it is now in hertz, meaning if the value is at 1, it will cycle once per second. You can change this range in the VCS without opening the VCS edit window by Ctrl+clicking on the widget and selecting Change range from the pop-up menu that opens.

Note that you have one other hot value in the LFO, namely !Modulation. This is simply a fancy word for the output level of the LFO.

Now back to the StepSequencer. As always, save any interesting presets in the VCS, and edit the VCS to make it look clean and have proper values for the new widgets.


Try all the presets. Note that the !Modulation hot value controls the level of the LFO, which in turn varies the tempo. When it is at 0, there is no variation. At a value of 1, there will be a lot of variation. Try the existing presets and save a few of your own.

In the sequencer Rate parameter field, experiment by substituting a * for a + (multiply instead of add). Try this and see what happens. Is there an advantage to using + here?


We’re going to go skip back one tutorial example, for simplicity, so this Sound builds on an earlier Sound rather than the one we were just working on.

Suppose you wanted to increase the number of steps, say, from 8 to 12? This is a simple matter of opening the sequencer, identifying all of the parameters that are associated with the eight steps, and copy/pasting four more steps in these fields while carefully maintaining all their characteristics.

TASK #1: For example, in the KeyPitches parameter field, copy the last four pitches (!P5 through !P8), paste them at the end of the field, and change the numbers to !P9 through !P12[If you would like them to sort automatically in the VCS, add leading zeros, for example, !P01 !P02 … !P11 !P12] Make the appropriate additions to the KeyDowns parameter field as well.

!StartIndex and !EndIndex must have their maximum values increased in order for the sequencer to access those extra pitches. Do this by unlocking the VCS edit window and changing the range to 0 through 11 with a 1 grid.

Reminder: Whenever you introduce new widgets to the VCS, you should unlock the VCS and make appropriate adjustments such as rearranging and resizing widgets and adjusting fader ranges.

For example, if you don’t change the range of the pitch widgets (P9, P10, etc.), they will, as most new unknown widgets will, default to a range of 0 to 1. Since we are dealing with MIDI note number values as specified in the Sample Frequency parameter field (the “nn” part of the expression — check it out by hovering your cursor over the purple nn), the default widget range of 0 to 1 will get you a frequency well below the limit of human hearing. They need to be set to 36 – 96 with a grid of 1 to mimic the MIDI keyboard range.

Reminder #2: Remember, the StepSequencer can be thought of as one big, resource-rich automated MIDI keyboard.


Be sure to make all the appropriate edits in the VCS edit window. There will be many. Some can be made globally with widgets that share the same values. Other VCS shortcuts include the horizontal squeezing. Try this out.


This concludes Part 1 of Tutorial B. Go on to Tutorial B, Part 2 using this same Sound file.

Tagged on:

Leave a Reply