First time here? Check out the FAQ!

What kind of random is the best for generating rhythmic velocity values inside the StepSequencer?

+1 vote
I am trying to make some random rhythmic pattern in a 16 stepsequencer. I guess the amazing EuSeq StepSequncer from the Galllery (AudioFileEditor) is a good starting point. Therefore I've experimented with the !VelDice random expressions and tried some other like nextChaotic, nextNormal and so on. But  there are always most of the steps with Velocity values greater than zero. For example a bassdrum sequence I need only a few steps with Velocity greater than zero. Thanks in Advance
asked Jan 13, 2016 in Capytalk & Smalltalk by knut-kaulke (Adept) (2,050 points)

2 Answers

+2 votes
One possible approach is to think of each step as having two variables, a logic value that enables the step, and a velocity value that the step uses if it is enabled. This lets you control whether a note is on or off independent of the range of possible velocity values. In other words you do not have to rely on !VelDice in your example to generate a value of zero to prevent the note from sounding. You can also use different probability functions for the enable and the velocity if you wish.

The enable's random function would need to output only 1 or 0. This can be accomplished by applying a threshold to whatever random generator you choose. For example, if the random generator outputs from 0 to 1 then using a ">" compare operator and a threshold value of 0.5 would mean that the enable would be on whenever the random value is above 0.5. If the random generator had a uniform probability distribution you would have notes sound half of the time.

The velocity value can use any random function you feel is appropriate but it should never output a value of zero or the note will not play when it should have. A scale-plus-offset control pattern would let you set a minimum and maximum value range. Here a uniform probability distribution is not as useful. A Gaussian or even a random walk could prove useful.

One last idea to consider is that in many rhythmic patterns there is the notion of strong beats, weak beats, and fills. Strong beats tend to have a much higher probability of occurance, and their strength (velocity) also tends to be higher. Weak beats have a lower probability of occurance and a lower velocity range. Fills are least likely but when they occur they often do so in clusters.

This suggests that it would be useful to have different enable and velocity functions for different groups of steps. The ultimate would be to have a different threshold for each step's enable function, and a different velocity range for each step. This would be very flexible but may prove a big "user unfriendly".
answered Jan 13, 2016 by delora-software (Master) (5,660 points)
Good points about the Enable + Velocity functions.  In the StepSequencer the enable function corresponds with the KeyDowns parameter field and the velocity function goes into the KeyVelocities field.
That's a very good train of thought. will try something!
+2 votes

A couple more ideas to add on to what delora-software has already said...

For random durations, you could also try using the Durations field of the StepSequencer.    For example: 

{1 to: 16 collect: [:i | (!BPM bpm random abs) roundTo: !Quantize]}

Or use a random trigger in the Step field, for example:

!BPM bpm random gt: !Thresh


answered Jan 13, 2016 by ssc (Savant) (127,140 points)