Data Structure and General Modes

A project log for Eurorack Mute Sequencer

Step sequencer for 8 mute tracks

j-m-hopkinsJ. M. Hopkins 03/18/2023 at 14:450 Comments

Main Sequencer Variables

The Mute Sequencer is an 8 track step sequencer, storing boolean values for the mute status. The maximum sequence length is 255 steps with 8 tracks containing the mute values. Length is the current sequence length (minimum 1, max 255) and step is the current step number. So if you look at sequencer[3][TRACK_1] you'd get the boolean value for Track 1 at step 3.

boolean[255][8] sequencer[step][track]
byte            length
byte            step 

To not get confused on the boolean value for mute/unmute, we also #define their values. And because tracks are 1 indexed physically, and 0 indexed logically we'll also add in #defines for them too. These will also double as their button numbers.

#define MUTE    false
#define UNMUTE  true

#define TRACK_1   0
#define TRACK_2_  1
#define TRACK_3   2
#define TRACK_4   3
#define TRACK_5   4
#define TRACK_6   5
#define TRACK_7   6
#define TRACK_8   7

Buttons have a few arrays to allow debounce and have state change flags for rising edge / falling edge logic.

boolean[14] button_current_state[button]
boolean[14] button_last_poll[button]
boolean[14] button_changed[button]

LEDs are a bit simpler, as they are just an array, but because we're controlling LED intensity as well, they are actually byte arrays for 0-255:

byte[14] led[button]

And adding a few more defines for the rest of the buttons and modes. (Mode is the general state machine state, of which we have 4)

#define BUT_STEP_PLUS   8
#define BUT_STEP_MINUS  9
#define BUT_ADD_UMO     10
#define BUT_DEL_MO      11
#define BUT_LIVE_EDIT   12
#define BUT_RESET    13

#define MODE_EDIT     0
#define MODE_LIVE     1
#define MODE_LIVE_UMO 2
#define MODE_LIVE_MO  3

Modes and general button behavior in the in next log...