4) Implementation of a shuffle rhythm function
Now we will implement a shuffle function to our Arduino Mega based step sequencer. A hardware switch will apply a HIGH signal to a digital input (ShufflePin is Pin 2) and to turn the shuffle on, where against a LOW signal at this pin means shuffle off. The rest is done by the software.
-2 x Resistor 220 Ohm
-1 x Resistor 100 kOhm
-1 x Diode
-1 x opto coupler IC GNY17-2
-2 x 5-pole DIN female connector (180°)
-1 x MIDI cable
-1 x MIDI sync master (here: Roland TR-505)
-1 x MIDI sync slave (here: DIY synthesizer with MIDI-input)
-1 x Arduino (here: Arduino Mega. For this demo also Arduinos with less input and output channels will work)
-N x Potentiometer 10 kOhm
-Switch for turning shuffle on and off
-10 kOhm pull-down Resistor for the switch
If the readout at the ShufflePin (pin 2) is LOW then the Shuffle_Flag=0 causing the ShuffleDelay to be 0. Then the sequencer runs as in the chapters before this one. However if the ShufflePin is set to HIGH by closing the respective switch, Shuffle_Flag will be 1. This means that every second 16th note will be delayed by 1 MIDI clock signals. The result is a shuffle rhythm. The effect can be increased, e.g. by setting ShuffleDelay = 2...4.