You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MicroDexed/sequencer.h

285 lines
15 KiB

typedef struct sequencer_s {
float drums_volume;
uint8_t seq_active_track = 0;
uint8_t seq_menu;
bool seq_button_r = false;
#ifdef TEENSY4
bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false};
uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 };
#else
bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false};
uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0 };
#endif
uint8_t seq_step = 0;
bool seq_running = false;
bool seq_recording = false;
bool smartfilter = true;
uint8_t seq_state_last_loadsave = 200;
char seq_name[FILENAME_LEN];
char seq_name_temp[FILENAME_LEN];
uint8_t seq_note_in;
uint8_t seq_note_in_velocity;
int seq_transpose;
uint8_t seq_chord_dexed_inst = 0;
uint8_t seq_chord_velocity = 60;
uint8_t seq_chord_key_ammount = 4;
uint8_t seq_element_shift = 0;
int seq_oct_shift = 0;
uint8_t arp_style = 0; // up, down, up&down, random
uint8_t seq_arps[6][23] = {
{ 0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 0}, //major
{ 0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 0}, //minor
{ 0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60, 64, 0}, //seventh
{ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 0}, //augmented
{ 0, 3, 6, 12, 15, 18, 24, 27, 30, 36, 39, 42, 48, 51, 54, 60, 63, 66, 72, 75, 78, 84, 0}, //dim
{ 0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60, 64, 0} //maj7
};
char seq_chord_names[7][4] = {
{'M', 'a', 'j', ' '}, //major
{'M', 'i', 'n', ' '},
{'s', 'e', 'v', ' '},
{'a', 'u', 'g', ' '},
{'d', 'i', 'm', ' '},
{ 'M', 'a', 'j', '7'},
{ 'N', 'o', 'C', 'd'}
};
char arp_style_names[4][3] = {
{ 'u', 'p', ' '},
{'d', 'w', 'n'},
{'u', '&', 'd'},
{'R', 'N', 'D'}
};
int seq_tempo_ms = 180000;
int seq_bpm = 102;
uint8_t seq_temp_select_menu;
uint8_t seq_temp_active_menu = 99;
uint8_t seq_chain_active_chainstep;
uint8_t seq_chain_lenght = 3; // 0 = 16 steps, 1 = 32 Steps, 2 = 46 Steps, 3 = 64 Steps
uint8_t seq_chain_active_step = 0;
uint8_t seq_prev_note[NUM_SEQ_TRACKS]; // note_offs for every (instr.) track
uint8_t seq_prev_vel[NUM_SEQ_TRACKS];
uint8_t arp_step;
uint8_t arp_note;
uint8_t arp_chord = 6;
bool arp_play_basenote = true;
uint8_t arp_note_prev;
uint8_t arp_octave;
uint8_t arp_prev_oct;
uint8_t arp_speed = 0;
uint8_t arp_counter = 0;
uint8_t arp_lenght = 8;
uint8_t seq_data_buffer[16] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
uint8_t seq_data[NUM_SEQ_PATTERN][16] = {
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
{ 0 , 0 , 0 , 0 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rumenttrack, 2= Chord or Arpeggio
#ifdef TEENSY4
uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = {
{ 0 , 2 , 6 , 9 , 99, 99 },
{ 1 , 2 , 5 , 8 , 99, 99 },
{ 0 , 2 , 6 , 9 , 99, 99 },
{ 1 , 2 , 5 , 7 , 99, 99 }
};
uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0, 1, 1, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
#else
uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = {
{ 0 , 2 },
{ 1 , 2 },
{ 0 , 2 },
{ 1 , 2 },
};
uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
#endif
} sequencer_t;
sequencer_t seq;
float drums_volume;
uint8_t seq_active_track = 0;
uint8_t seq_menu;
bool seq_button_r = false;
#ifdef TEENSY4
bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false};
uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 };
#else
bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false};
uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0 };
#endif
uint8_t seq_step = 0;
bool seq_running = false;
bool seq_recording = false;
bool smartfilter = true;
uint8_t seq_state_last_loadsave = 200;
char seq_name[FILENAME_LEN];
char seq_name_temp[FILENAME_LEN];
uint8_t seq_note_in;
uint8_t seq_note_in_velocity;
int seq_transpose;
uint8_t seq_chord_dexed_inst = 0;
uint8_t seq_chord_velocity = 60;
uint8_t seq_chord_key_ammount = 4;
uint8_t seq_element_shift = 0;
int seq_oct_shift = 0;
uint8_t arp_style = 0; // up, down, up&down, random
uint8_t seq_arps[6][23] = {
0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 0, //major
0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 0, //minor
0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60, 64, 0, //seventh
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 0, //augmented
0, 3, 6, 12, 15, 18, 24, 27, 30, 36, 39, 42, 48, 51, 54, 60, 63, 66, 72, 75, 78, 84, 0, //dim
0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60, 64, 0 //maj7
};
char seq_chord_names[7][4] = { 'M', 'a', 'j', ' ' , //major
'M', 'i', 'n', ' ' ,
's', 'e', 'v', ' ' ,
'a', 'u', 'g', ' ' ,
'd', 'i', 'm', ' ' ,
'M', 'a', 'j', '7' ,
'N', 'o', 'C', 'd' ,
};
char arp_style_names[4][3] = { 'u', 'p', ' ',
'd', 'w', 'n',
'u', '&', 'd',
'R', 'N', 'D',
};
int seq_tempo_ms = 180000;
int seq_bpm = 102;
uint8_t seq_temp_select_menu;
uint8_t seq_temp_active_menu = 99;
uint8_t seq_chain_active_chainstep;
uint8_t seq_chain_lenght = 3; // 0 = 16 steps, 1 = 32 Steps, 2 = 46 Steps, 3 = 64 Steps
uint8_t seq_chain_active_step = 0;
uint8_t seq_prev_note[NUM_SEQ_TRACKS]; // note_offs for every (instr.) track
uint8_t seq_prev_vel[NUM_SEQ_TRACKS];
uint8_t arp_step;
uint8_t arp_note;
uint8_t arp_chord = 6;
bool arp_play_basenote = true;
uint8_t arp_note_prev;
uint8_t arp_octave;
uint8_t arp_prev_oct;
uint8_t arp_speed = 0;
uint8_t arp_counter = 0;
uint8_t arp_lenght = 8;
uint8_t seq_data_buffer[16] = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 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, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 213 , 0 , 0 , 0 , 0 , 0 , 213 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
// 213 , 0 , 0 , 0 , 0 , 0 , 213 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 ,
// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 ,
// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
// };
//uint8_t seq_data[10][16] = {72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 ,
// 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 ,
// 72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 75 , 72 , 0 , 0 , 0 ,
// 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
// 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 0 , 0 ,
// 55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
// 57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
// 74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 130 , 130 , 130 , 130 , 0 ,
// 74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 130 , 0 , 0 , 0 , 0 ,
// 69 , 0 , 0 , 76 , 0 , 0 , 69 , 130 , 130 , 130 , 0 , 0 , 0 , 0 , 0 , 0
// };
//uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0,
// 105, 80, 105, 70, 106, 98, 106, 70, 126, 97, 106, 70, 106, 99, 90, 65,
// 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 60, 120, 120, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 1, 10, 30, 50, 70, 90, 100, 127, 100, 60, 40, 30, 0, 200,
// 200, 200, 200, 200, 200, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 200,
// 201, 200, 200, 200, 200, 200, 200, 200, 0, 0, 0, 0, 0, 0, 0, 0,
// 98, 120, 0, 88, 120, 0, 127, 120, 0, 0, 125, 120, 0, 0, 0, 0,
// 124, 120, 0, 115, 0, 0, 126, 120, 0, 120, 127, 120, 0, 0, 0, 0,
// 123, 120, 0, 110, 120, 0, 90, 120, 0, 0, 0, 0, 0, 0, 0, 0
// };
uint8_t seq_content_type[NUM_SEQ_PATTERN] = { 0, 0, 0, 0 , 0, 0, 0 , 0 , 0 , 0 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio
#ifdef TEENSY4
uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = { 0 , 2 , 6 , 9 , 99, 99,
1 , 2 , 5 , 8 , 99, 99,
0 , 2 , 6 , 9 , 99, 99,
1 , 2 , 5 , 7 , 99, 99
};
uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0, 1, 1, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
#else
uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = { 0 , 2 ,
1 , 2 ,
0 , 2 ,
1 , 2 ,
};
uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
#endif