Probabilistic Triggers
This is a demonstration of the wide variety of patterns you can get from a few lines of code running on the 'b. Another notable aspect of this program is the level of playability you get from just a few inputs.
This program is very simple. It is ultimately just a list of probabilities associated with a number of beats. The demonstration program uses three sequences, each one 4/4 measure long consisting of 16 sixteenth notes. There is nothing saying that they couldn't vary in length, clock divisions, or even tempo if that's what you wanted to do.
The code for this program includes the following probability sequences:
int snarelist[16] = { 0, 1, 1, 1, 75, 1, 1, 1, 0, 1, 1, 1, 75, 1, 1, 1 };
int kicklist[16] = { 90, 1, 1, 1, 0, 1, 10, 1, 75, 1, 1, 1, 0, 1, 15, 1 };
int hatlist[16] = { 85, 25, 85, 25, 85, 25, 85, 25, 85, 25, 85, 25, 85, 25, 85, 25 };
As you can see, the snare has 0 percent chance that it will ever fall on the 1 and 3 beats. Similarly, the kick will never fire on 2 or 4. The hihat sequence varies a little more, effectively preferring an 8th note pattern, but with a fair probability that some 16th notes will kick in as well as some probability that an 8th note will get dropped every now and again.
Each of the sequences also has a probability modifier. The probability modifier is an analog input that is used to increase or decrease the probability that one of the events will happen. When the knob is in the center (~2.5V) then the probabilities are exactly as they are assigned. If you want a particular part to happen a little less often, then decrease from the midpoint. As you do, the probability factor will decrease from 1.0 to 0.5 to 0.1 to 0.0.
As the value increases, the specified probability is multiplied by 1.5, 2.0, 5.0 up to 20.0. Note that since the factor is a multiple, that any event with a probability of zero will never increase above that value.
snaresequencer->setProbabilityModifier(DUE_IN_A01);
kicksequencer->setProbabilityModifier(DUE_IN_A02);
hatsequencer->setProbabilityModifier(DUE_IN_A03);
The full code listing [is available on github](https://github.com/nw2s/b/blob/master/sketches/nw2s/bDemoProbabilityTrigger/bDemoProbabilityTrigger.ino).
With the 'b, you could alternatively patch an LFO or other CV signal into the input to control the probability factor.
The triggers are sent to an LDB-1e which was recorded into Pro Tools through a Radial JDI. The signal was lightly mastered with a little compression and some peak limiting. Also note that I have since made a couple of fairly significant software updates that correct a couple of timing glitches the more astute of you may notice.