diff --git a/UI_FX.h b/UI_FX.h index 534f0de..9be0d1f 100644 --- a/UI_FX.h +++ b/UI_FX.h @@ -121,20 +121,21 @@ LCDML_add(87, LCDML_0, 5, "Sequencer", NULL); LCDML_add(88, LCDML_0_5, 1, "Sequencer", UI_func_sequencer); LCDML_add(89, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor); LCDML_add(90, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain); -LCDML_add(91, LCDML_0_5, 4, "Seq. Length", UI_func_seq_lenght); -LCDML_add(92, LCDML_0_5, 5, "Tempo", UI_func_seq_tempo); -LCDML_add(93, LCDML_0_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(94, LCDML_0_5, 7, "L.Trp.Offset", NULL); -LCDML_add(95, LCDML_0_5, 8, "Track Setup", UI_func_seq_track_setup); -LCDML_add(96, LCDML_0_5, 9, "Seq.Disp.Style", UI_func_seq_display_style); -LCDML_add(97, LCDML_0_5, 10, "LOAD Patterns", UI_func_seq_pattern_load); -LCDML_add(98, LCDML_0_5, 11, "SAVE Patterns", UI_func_seq_pattern_save); -LCDML_add(99, LCDML_0, 6, "System", NULL); -LCDML_add(100, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(101, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(102, LCDML_0_6, 3, "Favorites", UI_func_favorites); -LCDML_add(103, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(104, LCDML_0, 7, "Info", UI_func_information); -LCDML_addAdvanced(105, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 105 +LCDML_add(91, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio); +LCDML_add(92, LCDML_0_5, 5, "Seq. Length", UI_func_seq_lenght); +LCDML_add(93, LCDML_0_5, 6, "Tempo", UI_func_seq_tempo); +LCDML_add(94, LCDML_0_5, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct); +LCDML_add(95, LCDML_0_5, 8, "L.Trp.Offset", NULL); +LCDML_add(96, LCDML_0_5, 9, "Track Setup", UI_func_seq_track_setup); +LCDML_add(97, LCDML_0_5, 10, "Seq.Disp.Style", UI_func_seq_display_style); +LCDML_add(98, LCDML_0_5, 11, "LOAD Patterns", UI_func_seq_pattern_load); +LCDML_add(99, LCDML_0_5, 12, "SAVE Patterns", UI_func_seq_pattern_save); +LCDML_add(100, LCDML_0, 6, "System", NULL); +LCDML_add(101, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(102, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(103, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(104, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(105, LCDML_0, 7, "Info", UI_func_information); +LCDML_addAdvanced(106, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 106 #endif diff --git a/UI_NO_FX.h b/UI_NO_FX.h index 8fc7e9d..bd1e467 100644 --- a/UI_NO_FX.h +++ b/UI_NO_FX.h @@ -91,22 +91,23 @@ LCDML_add(57, LCDML_0_3, 2, "Drum Volumes", UI_func_drum_volume); LCDML_add(58, LCDML_0_3, 3, "Drum Pan", UI_func_drum_pan); LCDML_add(59, LCDML_0, 4, "Sequencer", NULL); LCDML_add(60, LCDML_0_4, 1, "Sequencer", UI_func_sequencer); -LCDML_add(61, LCDML_0_5, 2, "Velocity Edit", UI_func_seq_vel_editor); +LCDML_add(61, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor); LCDML_add(62, LCDML_0_4, 3, "Pattern Chain", UI_func_seq_pat_chain); -LCDML_add(63, LCDML_0_4, 4, "Seq. Length", UI_func_seq_lenght); -LCDML_add(64, LCDML_0_4, 5, "Tempo", UI_func_seq_tempo); -LCDML_add(65, LCDML_0_4, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(66, LCDML_0_5, 7, "Track Setup", UI_func_seq_track_setup); -LCDML_add(67, LCDML_0_5, 8, "Seq.Disp.Style", UI_func_seq_display_style); -LCDML_add(68, LCDML_0_4, 9, "LOAD Patterns", UI_func_seq_pattern_load); -LCDML_add(69, LCDML_0_4, 10, "SAVE Patterns", UI_func_seq_pattern_save); -LCDML_add(70, LCDML_0, 5, "System", NULL); -LCDML_add(71, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(72, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(73, LCDML_0_5, 3, "Favorites", UI_func_favorites); -LCDML_add(74, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(75, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(76, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 76 +LCDML_add(63, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio); +LCDML_add(64, LCDML_0_4, 5, "Seq. Length", UI_func_seq_lenght); +LCDML_add(65, LCDML_0_4, 6, "Tempo", UI_func_seq_tempo); +LCDML_add(66, LCDML_0_4, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct); +LCDML_add(67, LCDML_0_5, 8, "Track Setup", UI_func_seq_track_setup); +LCDML_add(68, LCDML_0_5, 9, "Seq.Disp.Style", UI_func_seq_display_style); +LCDML_add(69, LCDML_0_4, 10, "LOAD Patterns", UI_func_seq_pattern_load); +LCDML_add(70, LCDML_0_4, 11, "SAVE Patterns", UI_func_seq_pattern_save); +LCDML_add(71, LCDML_0, 5, "System", NULL); +LCDML_add(72, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(73, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(74, LCDML_0_5, 3, "Favorites", UI_func_favorites); +LCDML_add(75, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(76, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(77, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 77 #endif diff --git a/sequencer.cpp b/sequencer.cpp index da84662..bad6929 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -10,6 +10,7 @@ extern config_t configuration; extern void handleNoteOn(byte , byte , byte ); extern void handleNoteOff(byte , byte , byte ); extern void UI_func_sequencer(uint8_t); +extern void UI_func_arpeggio(uint8_t); extern const char* seq_find_shortname(uint8_t); void sequencer(void) @@ -27,7 +28,7 @@ void sequencer(void) { seq_timer_previous = seq_millis_timer; - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { //is in UI of Sequencer //write to sequencer if in sequencer menu if (seq_note_in > 0 && seq_recording == true) { @@ -51,7 +52,13 @@ void sequencer(void) lcd.print(seq_find_shortname(seq_step - 1)[0]); } } - + else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_arpeggio)) { //is in UI of Arpeggiator + lcd.setCursor(7, 0); + lcd.print( seq_chord_names[arp_chord - 200][0]); + lcd.print( seq_chord_names[arp_chord - 200][1]); + lcd.print( seq_chord_names[arp_chord - 200][2]); + lcd.print( seq_chord_names[arp_chord - 200][3]); + } for (uint8_t d = 0; d < 4; d++) { if ( seq_track_type[d] == 0) { // drum track @@ -78,46 +85,61 @@ void sequencer(void) handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][3], seq_chord_velocity); } } - else if (seq_track_type[d] == 3) { //Arp - arp_step = 0; + arp_step = 0; + arp_counter = 0; arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose; arp_chord = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; - } - } } - if (seq_track_type[d] == 3) { //Arp - if (arp_step == 0 ) { - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note+ arp_octave * 12 , seq_chord_velocity); - arp_note_prev = arp_note+arp_octave * 12; - - } - else - { - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12, seq_chord_velocity); - arp_note_prev = arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12; - + if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 2) ) { + if (arp_step == 0 ) { + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + arp_octave * 12 , seq_chord_velocity); + arp_note_prev = arp_note + arp_octave * 12; + } + else + { if (arp_style == 0) { //arp up + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12, seq_chord_velocity); + arp_note_prev = arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12; + } + else if (arp_style == 3) { //arp random + uint8_t rnd1 = random(4); + uint8_t rnd2 = random(arp_oct_usersetting + 1) * 12; + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][rnd1] + rnd2, seq_chord_velocity); + arp_note_prev = arp_note + seq_chords[arp_chord - 200][rnd1] + rnd2; + } + } } } - seq_noteoffsent[d] = false; } seq_step++; - arp_step++; - if (arp_step > 3) { + if (arp_speed == 0) // Arp Speed 1/16 + { + arp_step++; + } + else + { + if (arp_speed == 1) // Arp Speed 1/8 + { + if (arp_counter > 1) { + arp_counter = 0; + arp_step++; + } + arp_counter++; + } + } + if (arp_step > 3 || seq_chords[arp_chord - 200][arp_step] == 0 ) { arp_step = 0; arp_octave++; - if (arp_octave > 1) arp_octave = 0; + if (arp_octave > arp_oct_usersetting) arp_octave = 0; } if (seq_step > 15) { - - seq_step = 0; if (seq_chain_lenght > 0) { seq_chain_active_step++; @@ -135,26 +157,18 @@ void sequencer(void) if ( seq_noteoffsent[d] == false) { if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0) //test instrument sequencer Instance=0 { - handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0); - if (seq_track_type[d] == 2) { //Chords if ( seq_prev_vel[d] > 199) { - handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][0], 0); handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][1] , 0); handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][2] , 0); handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][3] , 0); } - } - - else if (seq_track_type[d] == 3) + else if (seq_track_type[d] == 3) { //Arp - - handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0); - } } } diff --git a/sequencer.h b/sequencer.h index 53cfa84..84a5237 100644 --- a/sequencer.h +++ b/sequencer.h @@ -14,6 +14,7 @@ int seq_transpose; uint8_t seq_inst_dexed[4] = { 1, 1, 1, 1 }; uint8_t seq_chord_dexed_inst = 0; uint8_t seq_chord_velocity = 50; +uint8_t arp_style = 0; // up, down, up&down, random uint8_t seq_chords[6][4] = { 4, 7, 12, 0, //major 3, 7, 12, 0, //minor 4, 7, 10, 12, //seventh @@ -21,12 +22,26 @@ uint8_t seq_chords[6][4] = { 4, 7, 12, 0, //major 3, 6, 12, 0, //dim 4, 7, 11 , 0 //maj7, }; +char seq_chord_names[6][4] = { 'M', 'a', 'j', ' ' , //major + 'M', 'i', 'n', ' ' , + 's', 'e', 'v', ' ' , + 'a', 'u', 'g', ' ' , + 'd', 'i', 'm', ' ' , + 'M', 'a', 'j', '7' , + }; + + +char arp_style_names[4][3] = { 'u', 'p', ' ', + 'd', 'w', 'n', + 'u', '&', 'd', + 'R', 'N', 'D', + }; int seq_tempo_ms = 147; 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_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[4]; // note_offs for every (instr.) track uint8_t seq_prev_vel[4]; @@ -36,23 +51,26 @@ uint8_t arp_chord; 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_oct_usersetting = 1; 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 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 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 , - 55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , //c1 - 57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , //C2 + 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 , 0 , 0 , 0 , 0 , 0 , 74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 0 , 0 , 0 , 0 , 0 , 69 , 0 , 0 , 76 , 0 , 0 , 69 , 0 , 0 , 0 , 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, +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, 50, 120, 120, 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, 200, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, @@ -62,8 +80,8 @@ uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, uint8_t seq_patternchain[4][4] = { 0 , 1 , 6 , 9 , 0 , 1 , 5 , 8 , 0 , 1 , 6 , 9 , 2 , 1 , 5 , 7 }; -uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 2, 2 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord, 3= Arpeggio -uint8_t seq_track_type[4] = { 0, 0, 3, 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord, 3=Arp, 4=Chord+Arp +uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 2, 2 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio +uint8_t seq_track_type[4] = { 0, 0, 3, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp //uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0,