From 4e76a3f8865db76bbd8202e9b000680243f65596 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sat, 14 Aug 2021 20:20:54 +0200 Subject: [PATCH] Arpeggiator fixes, UI fixes --- MicroDexed.ino | 10 +++++----- dexed_sd.cpp | 5 ----- sequencer.cpp | 30 +++++++++++++++++------------- sequencer.h | 23 +++++++++++++---------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 441fb67..23d1f5e 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -363,7 +363,7 @@ extern LCDMenuLib2 LCDML; extern void getNoteName(char* noteName, uint8_t noteNumber); PeriodicTimer timer1; -extern char seq_chord_names[6][4]; +extern char seq_chord_names[7][4]; /*********************************************************************** SETUP @@ -679,10 +679,10 @@ void setup() 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]); + lcd.print( seq_chord_names[arp_chord][0]); + lcd.print( seq_chord_names[arp_chord][1]); + lcd.print( seq_chord_names[arp_chord][2]); + lcd.print( seq_chord_names[arp_chord][3]); } } } diff --git a/dexed_sd.cpp b/dexed_sd.cpp index f3f1895..95886dc 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -830,8 +830,6 @@ bool save_sd_seq_json(uint8_t seq_number) for (uint8_t i = 0; i < MAX_DEXED; i++) { data_json["reverb_send"][i] = configuration.fx.reverb_send[i]; - data_json["perform_attack_mod"][i] = perform_attack_mod[i]; - data_json["perform_release_mod"][i] = perform_release_mod[i]; } data_json["reverb_roomsize"] = configuration.fx.reverb_roomsize; @@ -955,9 +953,6 @@ bool load_sd_seq_json(uint8_t seq_number) for (uint8_t i = 0; i < MAX_DEXED; i++) { configuration.fx.reverb_send[i] = data_json["reverb_send"][i]; - //perform_attack_mod[i] = data_json["perform_attack_mod"][i]; - //perform_release_mod[i] = data_json["perform_release_mod"][i]; - } configuration.fx.reverb_roomsize = data_json["reverb_roomsize"]; configuration.fx.reverb_damping = data_json["reverb_damping"]; diff --git a/sequencer.cpp b/sequencer.cpp index 5bf8ae8..4e69626 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -49,9 +49,9 @@ void sequencer_part1(void) else { if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0) // instrument track { - if (seq_track_type[d] == 1 || seq_track_type[d] == 3 ) + if (seq_track_type[d] == 1 || (seq_track_type[d] == 3 && arp_play_basenote) ) { - handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]); + handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]); } seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose; seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; @@ -68,34 +68,37 @@ void sequencer_part1(void) 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_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]-200>=0) + arp_chord = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]-200; } } } if (seq_track_type[d] == 3) { //Arp - if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 2) ) { - if (arp_step == 0 ) { + if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 0) ) { + + if (arp_step % 8 ==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; + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord][arp_step] + arp_octave * 12, seq_chord_velocity); + arp_note_prev = arp_note + seq_chords[arp_chord][arp_step] + 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; + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord][rnd1] + rnd2, seq_chord_velocity); + arp_note_prev = arp_note + seq_chords[arp_chord][rnd1] + rnd2; } } } } + seq_noteoffsent[d] = false; } - + arp_counter++; seq_step++; if (arp_speed == 0) // Arp Speed 1/16 @@ -110,13 +113,14 @@ void sequencer_part1(void) arp_counter = 0; arp_step++; } - arp_counter++; + } } - if (arp_step > 3 || seq_chords[arp_chord - 200][arp_step] == 0 ) { + //if (arp_step > 3 || seq_chords[arp_chord][arp_step] == 0 ) { + if (arp_step > 3 || seq_chords[arp_chord][arp_step] == 0 ) { arp_step = 0; arp_octave++; - if (arp_octave > arp_oct_usersetting) arp_octave = 0; + if (arp_octave >= arp_oct_usersetting) arp_octave = 0; } if (seq_step > 15) { seq_step = 0; diff --git a/sequencer.h b/sequencer.h index 025d8eb..a50aa03 100644 --- a/sequencer.h +++ b/sequencer.h @@ -9,23 +9,25 @@ bool seq_recording = false; uint8_t seq_note_in; uint8_t seq_note_in_velocity; int seq_transpose; -uint8_t seq_inst_dexed[4] = { 0, 0, 0, 1 }; +uint8_t seq_inst_dexed[4] = { 0, 0, 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 - 4, 8, 12, 0, //augmented - 3, 6, 12, 0, //dim - 4, 7, 11 , 0 //maj7, +uint8_t seq_chords[7][4] = { 4, 7, 0, 0, //major + 3, 7, 0, 0, //minor + 4, 7, 10, 0, //seventh + 4, 8, 0, 0, //augmented + 3, 6, 0 , 0, //dim + 4, 7, 11, 0, //maj7, + 0, 0, 0 , 0 //no Chord }; -char seq_chord_names[6][4] = { 'M', 'a', 'j', ' ' , //major +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' , }; @@ -45,7 +47,8 @@ uint8_t seq_prev_note[4]; // note_offs for every (instr.) track uint8_t seq_prev_vel[4]; uint8_t arp_step; uint8_t arp_note; -uint8_t arp_chord; +uint8_t arp_chord = 6; +bool arp_play_basenote=true; uint8_t arp_note_prev; uint8_t arp_octave; uint8_t arp_prev_oct; @@ -78,7 +81,7 @@ 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, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio -uint8_t seq_track_type[4] = { 0, 0, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp +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,