From 03bd2f1dd11d29b23d802ac6852816346eebc67a Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Fri, 14 May 2021 15:13:06 +0200 Subject: [PATCH 01/10] Add extra functions to transpose buttons Changed: - Transpose on button release instead of press. Added: - Play notes a semitone sharp or flat while up resp. down button is pressed. - Absolute transpose when both up and down buttons are pressed. Center C# is the default. This makes it possible to do more interesting transposing. --- src/src.ino | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/src.ino b/src/src.ino index 655a628..1881aab 100644 --- a/src/src.ino +++ b/src/src.ino @@ -61,6 +61,9 @@ uint8_t osc_pulse_midi_note = 0; uint8_t note_is_playing = 0; bool note_is_triggered = false; int transpose = 0; +int key_down = 0; +int key_up = 0; +uint8_t key_note[10] = { 0 }; bool next_step_is_random = false; int tempo_interval; bool random_flag = 0; @@ -264,8 +267,13 @@ void keys_scan() { if (k <= KEYB_9 && k >= KEYB_0) { if(in_setup) { midi_set_channel((k - KEYB_0) + 1); + } else if (key_down && key_up) { + transpose = SCALE[k - KEYB_0] - 61; } else { - keyboard_set_note(SCALE[k - KEYB_0]); + key_note[k - KEYB_0] = SCALE[k - KEYB_0] - (key_down&1) + (key_up&1); + keyboard_set_note(key_note[k - KEYB_0]); + if (key_down == 1) {key_down = 3;} + if (key_up == 1) {key_up = 3;} } } else if (k <= STEP_8 && k >= STEP_1) { step_enable[k-STEP_1] = 1-step_enable[k-STEP_1]; @@ -277,11 +285,9 @@ void keys_scan() { } double_speed = true; } else if (k == BTN_DOWN) { - transpose--; - if(transpose<-12){transpose = -24;} + key_down = 1; } else if (k == BTN_UP) { - transpose++; - if(transpose>12){transpose = 24;} + key_up = 1; } else if (k == BTN_SEQ1) { next_step_is_random = true; if(!sequencer_is_running) { @@ -316,15 +322,21 @@ void keys_scan() { break; case RELEASED: if (k <= KEYB_9 && k >= KEYB_0) { - keyboard_unset_note(SCALE[k - KEYB_0]); + keyboard_unset_note(key_note[k - KEYB_0]); } else if (k == BTN_SEQ2) { double_speed = false; } else if (k == BTN_DOWN) { - if(transpose<-12){transpose = -12;} - if(transpose>12){transpose = 12;} + if (key_down == 1) { + transpose--; + if (transpose < -12) {transpose = -12;} + } + key_down = 0; } else if (k == BTN_UP) { - if(transpose<-12){transpose = -12;} - if(transpose>12){transpose = 12;} + if (key_up == 1) { + transpose++; + if (transpose > 12) {transpose = 12;} + } + key_up = 0; } else if (k == BTN_SEQ1) { next_step_is_random = false; random_flag = false; From 3aa904c6357a018950e840ce1cc64de321550627 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Fri, 14 May 2021 15:15:39 +0200 Subject: [PATCH 02/10] Add color to white button notes, now that they can be played on Duo. --- src/Leds.h | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Leds.h b/src/Leds.h index 9e669df..03c9362 100644 --- a/src/Leds.h +++ b/src/Leds.h @@ -19,32 +19,32 @@ CRGB physical_leds[NUM_LEDS]; #define SK6812_BRIGHTNESS 32 #define SK6805_BRIGHTNESS 140 -/* The black keys have assigned colors. The white keys are shown in gray */ +/* The black keys have most primary colors. The white keys are inbetween */ const CRGB COLORS[] = { - 0x444444, - 0xFF0001, - 0x444444, - 0xFFDD00, - 0x444444, - 0x444444, - 0x11FF00, - 0x444444, - 0x0033DD, - 0x444444, - 0xFF00FF, - 0x444444, - 0x444444, - 0xFF2209, - 0x444444, - 0x99FF00, - 0x444444, - 0x444444, - 0x00EE22, - 0x444444, - 0x0099CC, - 0x444444, - 0xBB33BB, - 0x444444 + 0xEE0033, // C + 0xFF0001, // C# + 0xFF4400, // D + 0xFFDD00, // D# + 0xBBEE00, // E + 0x66EE00, // F + 0x11FF00, // F# + 0x006644, // G + 0x0033DD, // G# + 0x4411EE, // A + 0xFF00FF, // A# + 0xFF1166, // B + 0xFF1122, // C + 0xFF2209, // C# + 0xFF8811, // D + 0xFFEE22, // D# + 0x99DD22, // E + 0x44BB22, // F + 0x00EE22, // F# + 0x00CC44, // G + 0x0099CC, // G# + 0x4455CC, // A + 0xBB33BB, // A# + 0xFF6666 // B }; void led_init(); From ade72be4c1b67337c3b647f7014d4baedbd1c57c Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Tue, 1 Aug 2023 17:45:22 +0200 Subject: [PATCH 03/10] skip step feature first try --- src/Leds.h | 4 +++- src/Sequencer.h | 4 ++++ src/src.ino | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Leds.h b/src/Leds.h index 03c9362..39008ba 100644 --- a/src/Leds.h +++ b/src/Leds.h @@ -99,8 +99,10 @@ void led_init() { // Updates the LED colour and brightness to match the stored sequence void led_update() { for (int l = 0; l < SEQUENCER_NUM_STEPS; l++) { - if (step_enable[l]) { + if (step_enable[l] == 1) { leds(l) = COLORS[step_note[l]%24]; + } else if (step_enable[l] == 2) { + leds(l) = CRGB(57, 64, 37); // skip step } else { leds(l) = CRGB::Black; } diff --git a/src/Sequencer.h b/src/Sequencer.h index db9e3a3..615e216 100644 --- a/src/Sequencer.h +++ b/src/Sequencer.h @@ -133,6 +133,10 @@ void sequencer_advance_without_play() { } current_step++; current_step%=SEQUENCER_NUM_STEPS; + if (step_enable[current_step] == 2) { + current_step++; + current_step%=SEQUENCER_NUM_STEPS; + } if (!next_step_is_random && !random_flag) { random_offset = 0; diff --git a/src/src.ino b/src/src.ino index 1881aab..db3bd42 100644 --- a/src/src.ino +++ b/src/src.ino @@ -276,7 +276,7 @@ void keys_scan() { if (key_up == 1) {key_up = 3;} } } else if (k <= STEP_8 && k >= STEP_1) { - step_enable[k-STEP_1] = 1-step_enable[k-STEP_1]; + step_enable[k-STEP_1] = !step_enable[k-STEP_1]; if(!step_enable[k-STEP_1]) { leds(k-STEP_1) = CRGB::Black; } step_velocity[k-STEP_1] = INITIAL_VELOCITY; } else if (k == BTN_SEQ2) { @@ -303,6 +303,9 @@ void keys_scan() { if(in_setup) { midi_set_channel((k - KEYB_0) + 1); } + } else if (k <= STEP_8 && k >= STEP_1) { + step_enable[k-STEP_1] = 2; + leds(k-STEP_1) = CRGB(57, 64, 37); } else if (k == SEQ_START) { #ifdef DEV_MODE sequencer_stop(); From aa143711b9168dd4399634e0e0568bf2bd5d47a9 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Tue, 1 Aug 2023 22:40:12 +0200 Subject: [PATCH 04/10] finish skip step feature --- src/Leds.h | 2 +- src/Sequencer.h | 36 +++++++++++++++++++++++++++--------- src/src.ino | 21 ++++++++++++++++++--- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/Leds.h b/src/Leds.h index 39008ba..470df8c 100644 --- a/src/Leds.h +++ b/src/Leds.h @@ -11,7 +11,7 @@ #define LED_WHITE CRGB(230,255,150) #define leds(A) physical_leds[led_order[A]] -#define next_step ((current_step+1)%SEQUENCER_NUM_STEPS) +// #define next_step ((current_step+1)%SEQUENCER_NUM_STEPS) CRGB physical_leds[NUM_LEDS]; #define led_play physical_leds[0] diff --git a/src/Sequencer.h b/src/Sequencer.h index 615e216..b713ba3 100644 --- a/src/Sequencer.h +++ b/src/Sequencer.h @@ -13,6 +13,7 @@ const uint8_t SEQUENCER_NUM_STEPS = 8; uint8_t step_note[] = { 1,0,6,9,0,4,0,5 }; uint8_t step_enable[] = { 1,0,1,1,1,1,0,1 }; uint8_t step_velocity[] = { 100,100,100,100,100,100,100,100 }; +uint8_t num_steps_used = SEQUENCER_NUM_STEPS; void sequencer_init(); void sequencer_restart(); @@ -51,12 +52,14 @@ void sequencer_init() { tempo_handler.setPPQN(PULSES_PER_QUARTER_NOTE); sequencer_stop(); current_step = SEQUENCER_NUM_STEPS - 1; + next_step = 0; } void sequencer_restart() { MIDI.sendRealTime(midi::Start); delay(1); current_step = SEQUENCER_NUM_STEPS - 1; + next_step = 0; tempo_handler.midi_clock_reset(); sequencer_is_running = true; sequencer_clock = 0; @@ -125,25 +128,39 @@ void sequencer_tick_clock() { sequencer_clock++; } +void update_next_step() { + next_step = current_step; + for (int i = 0; i < SEQUENCER_NUM_STEPS; i++) { + next_step = (next_step + 1) % SEQUENCER_NUM_STEPS; + if (step_enable[next_step] != 2) break; + } +} + void sequencer_advance_without_play() { static uint8_t arpeggio_index = 0; if(!note_is_done_playing) { sequencer_untrigger_note(); } - current_step++; - current_step%=SEQUENCER_NUM_STEPS; - if (step_enable[current_step] == 2) { - current_step++; - current_step%=SEQUENCER_NUM_STEPS; - } + // update_next_step(); + current_step = next_step; + update_next_step(); if (!next_step_is_random && !random_flag) { random_offset = 0; } else { random_flag = false; - random_offset = random(1,(SEQUENCER_NUM_STEPS - 2)); - //current_step = ((current_step + random(2, SEQUENCER_NUM_STEPS))%SEQUENCER_NUM_STEPS); + random_offset = random(num_steps_used); + // select random step from the used steps + for(int i = 0; i < SEQUENCER_NUM_STEPS; i++) { + if (step_enable[(current_step + i) % SEQUENCER_NUM_STEPS] != 2) { + random_offset--; + if (random_offset < 0) { + random_offset = i; + break; + } + } + } } // Sample keys @@ -171,7 +188,8 @@ void sequencer_advance() { } void sequencer_reset() { - current_step = SEQUENCER_NUM_STEPS; + current_step = SEQUENCER_NUM_STEPS - 1; + next_step = 0; } void sequencer_update() { diff --git a/src/src.ino b/src/src.ino index db3bd42..7bca36f 100644 --- a/src/src.ino +++ b/src/src.ino @@ -51,6 +51,7 @@ int gate_length_msec = 40; uint32_t sequencer_clock = 0; // Sequencer settings uint8_t current_step; +uint8_t next_step; int tempo = 0; uint8_t set_key = 9; float osc_saw_frequency = 0.; @@ -276,7 +277,12 @@ void keys_scan() { if (key_up == 1) {key_up = 3;} } } else if (k <= STEP_8 && k >= STEP_1) { - step_enable[k-STEP_1] = !step_enable[k-STEP_1]; + if (step_enable[k-STEP_1] == 2) { + step_enable[k-STEP_1] = 1; + num_steps_used++; + } else { + step_enable[k-STEP_1] = !step_enable[k-STEP_1]; + } if(!step_enable[k-STEP_1]) { leds(k-STEP_1) = CRGB::Black; } step_velocity[k-STEP_1] = INITIAL_VELOCITY; } else if (k == BTN_SEQ2) { @@ -304,8 +310,17 @@ void keys_scan() { midi_set_channel((k - KEYB_0) + 1); } } else if (k <= STEP_8 && k >= STEP_1) { - step_enable[k-STEP_1] = 2; - leds(k-STEP_1) = CRGB(57, 64, 37); + // skip step + if (step_enable[k-STEP_1] != 2 && num_steps_used > 1) { + step_enable[k-STEP_1] = 2; + num_steps_used--; + // in case the skipped step is the next step, + // advance next_step until the next used step + for (int i = 0; i < SEQUENCER_NUM_STEPS; i++) { + if (step_enable[next_step] != 2) break; + next_step = (next_step + 1) % SEQUENCER_NUM_STEPS; + } + } } else if (k == SEQ_START) { #ifdef DEV_MODE sequencer_stop(); From a1b82410d7cde402aeb3a00a683821b3c5e9367e Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 00:14:13 +0200 Subject: [PATCH 05/10] fix bug with disabled notes not ending while random is pressed --- src/src.ino | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/src.ino b/src/src.ino index 7bca36f..4cc4a4b 100644 --- a/src/src.ino +++ b/src/src.ino @@ -422,11 +422,10 @@ void note_off() { if (note_is_playing) { MIDI.sendNoteOff(note_is_playing, 0, MIDI_CHANNEL); usbMIDI.sendNoteOff(note_is_playing, 0, MIDI_CHANNEL); + envelope1.noteOff(); + envelope2.noteOff(); if(!step_enable[current_step]) { leds(current_step) = CRGB::Black; - } else { - envelope1.noteOff(); - envelope2.noteOff(); } note_is_playing = 0; } From 12150d9b3d2b7730b776fd35962b9048a0434bc5 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 00:15:38 +0200 Subject: [PATCH 06/10] remove unnecessary led control outside of Leds.h --- src/src.ino | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/src.ino b/src/src.ino index 4cc4a4b..70dfe05 100644 --- a/src/src.ino +++ b/src/src.ino @@ -283,7 +283,6 @@ void keys_scan() { } else { step_enable[k-STEP_1] = !step_enable[k-STEP_1]; } - if(!step_enable[k-STEP_1]) { leds(k-STEP_1) = CRGB::Black; } step_velocity[k-STEP_1] = INITIAL_VELOCITY; } else if (k == BTN_SEQ2) { if(!sequencer_is_running) { @@ -412,9 +411,6 @@ void note_on(uint8_t midi_note, uint8_t velocity, bool enabled) { usbMIDI.sendNoteOn(midi_note, velocity, MIDI_CHANNEL); envelope1.noteOn(); envelope2.noteOn(); - } else { - leds((current_step+random_offset)%SEQUENCER_NUM_STEPS) = LED_WHITE; - } } @@ -424,9 +420,6 @@ void note_off() { usbMIDI.sendNoteOff(note_is_playing, 0, MIDI_CHANNEL); envelope1.noteOff(); envelope2.noteOff(); - if(!step_enable[current_step]) { - leds(current_step) = CRGB::Black; - } note_is_playing = 0; } } From 81ed0344ac0ea518aeb23ccd7b21e06f89c2d305 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 00:16:09 +0200 Subject: [PATCH 07/10] rewrite too long line --- src/Sequencer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Sequencer.h b/src/Sequencer.h index b713ba3..99f64cd 100644 --- a/src/Sequencer.h +++ b/src/Sequencer.h @@ -208,7 +208,8 @@ static void sequencer_trigger_note() { step_velocity[current_step] = INITIAL_VELOCITY; - note_on(step_note[((current_step+random_offset)%SEQUENCER_NUM_STEPS)]+transpose, step_velocity[((current_step+random_offset)%SEQUENCER_NUM_STEPS)], step_enable[((current_step+random_offset)%SEQUENCER_NUM_STEPS)]); + uint8_t step = ((current_step+random_offset)%SEQUENCER_NUM_STEPS); + note_on(step_note[step]+transpose, step_velocity[step], step_enable[step]); } static void sequencer_untrigger_note() { From 9bcf8774f5589e59a23d0d7fbf080bb59cb975c1 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 02:14:44 +0200 Subject: [PATCH 08/10] add step delay feature by pressing the boost key when step keys are pressed --- src/Sequencer.h | 11 +++++++++-- src/src.ino | 27 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/Sequencer.h b/src/Sequencer.h index 99f64cd..88ec150 100644 --- a/src/Sequencer.h +++ b/src/Sequencer.h @@ -13,6 +13,7 @@ const uint8_t SEQUENCER_NUM_STEPS = 8; uint8_t step_note[] = { 1,0,6,9,0,4,0,5 }; uint8_t step_enable[] = { 1,0,1,1,1,1,0,1 }; uint8_t step_velocity[] = { 100,100,100,100,100,100,100,100 }; +uint8_t step_delay[] = { 0,0,0,0,0,0,0,0 }; uint8_t num_steps_used = SEQUENCER_NUM_STEPS; void sequencer_init(); @@ -122,8 +123,14 @@ void sequencer_tick_clock() { } } - if(sequencer_is_running && (sequencer_clock % sequencer_divider)==0) { - sequencer_advance(); + if(sequencer_is_running) { + if ((sequencer_clock % sequencer_divider) == 0) { + sequencer_advance_without_play(); + } + if ((sequencer_clock % sequencer_divider) == step_delay[current_step] * sequencer_divider / 6) { + // deliberately keep the rythm when random is pressed + sequencer_trigger_note(); + } } sequencer_clock++; } diff --git a/src/src.ino b/src/src.ino index 70dfe05..1f9809e 100644 --- a/src/src.ino +++ b/src/src.ino @@ -65,6 +65,7 @@ int transpose = 0; int key_down = 0; int key_up = 0; uint8_t key_note[10] = { 0 }; +uint8_t stepkeys = 0; bool next_step_is_random = false; int tempo_interval; bool random_flag = 0; @@ -280,15 +281,31 @@ void keys_scan() { if (step_enable[k-STEP_1] == 2) { step_enable[k-STEP_1] = 1; num_steps_used++; + step_delay[k-STEP_1] = 0; + } else if (step_enable[k-STEP_1] == 0) { + step_enable[k-STEP_1] = 1; + step_delay[k-STEP_1] = 0; } else { - step_enable[k-STEP_1] = !step_enable[k-STEP_1]; + step_enable[k-STEP_1] = 0; } step_velocity[k-STEP_1] = INITIAL_VELOCITY; + stepkeys |= 1<<(k-STEP_1); } else if (k == BTN_SEQ2) { - if(!sequencer_is_running) { - sequencer_advance(); + // if step keys are pressed add a delay to those steps + if (stepkeys) { + for (int i = 0; i < SEQUENCER_NUM_STEPS; i++) { + if (stepkeys & 1<= KEYB_0) { keyboard_unset_note(key_note[k - KEYB_0]); + } else if (k <= STEP_8 && k >= STEP_1) { + stepkeys &= ~(1<<(k-STEP_1)); } else if (k == BTN_SEQ2) { double_speed = false; } else if (k == BTN_DOWN) { From 6f071743e2938fc8bd159c29428d5d1712b696ee Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 02:36:57 +0200 Subject: [PATCH 09/10] move led update outside loop, save CPU cycles --- src/Leds.h | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Leds.h b/src/Leds.h index 470df8c..1ae1b11 100644 --- a/src/Leds.h +++ b/src/Leds.h @@ -106,35 +106,35 @@ void led_update() { } else { leds(l) = CRGB::Black; } - - if(note_is_playing) { - leds(((current_step+random_offset)%SEQUENCER_NUM_STEPS)) = LED_WHITE; - } else { - if(!step_enable[((current_step+random_offset)%SEQUENCER_NUM_STEPS)]) { - leds(((current_step+random_offset)%SEQUENCER_NUM_STEPS)) = CRGB::Black; - } + } + + if(note_is_playing) { + leds(((current_step+random_offset)%SEQUENCER_NUM_STEPS)) = LED_WHITE; + } else { + if(!step_enable[((current_step+random_offset)%SEQUENCER_NUM_STEPS)]) { + leds(((current_step+random_offset)%SEQUENCER_NUM_STEPS)) = CRGB::Black; + } - if(!sequencer_is_running) { - if(((sequencer_clock % 24) < 12)) { - if(step_enable[next_step]) { - leds(next_step) = COLORS[step_note[next_step]%24]; - } else { - leds(next_step) = CRGB::Black; - } - led_play = LED_WHITE; - led_play.fadeLightBy((sequencer_clock % 12)*16); + if(!sequencer_is_running) { + if(((sequencer_clock % 24) < 12)) { + if(step_enable[next_step]) { + leds(next_step) = COLORS[step_note[next_step]%24]; } else { - led_play = CRGB::Black; - if(step_enable[next_step]) { - leds(next_step) = blend(LED_WHITE, COLORS[step_note[next_step]%24], (sequencer_clock % 12)*16); - } else { - leds(next_step) = LED_WHITE; - leds(next_step) = leds(next_step).fadeLightBy((sequencer_clock % 12)*16); - } + leds(next_step) = CRGB::Black; } - } else { led_play = LED_WHITE; + led_play.fadeLightBy((sequencer_clock % 12)*16); + } else { + led_play = CRGB::Black; + if(step_enable[next_step]) { + leds(next_step) = blend(LED_WHITE, COLORS[step_note[next_step]%24], (sequencer_clock % 12)*16); + } else { + leds(next_step) = LED_WHITE; + leds(next_step) = leds(next_step).fadeLightBy((sequencer_clock % 12)*16); + } } + } else { + led_play = LED_WHITE; } } FastLED.show(); From 58c9bd23f50781a12503f50a5f795da4916f1789 Mon Sep 17 00:00:00 2001 From: Piers Titus van der Torren Date: Wed, 2 Aug 2023 02:40:14 +0200 Subject: [PATCH 10/10] add feature to make certain steps always random activate by pressing the random key when step keys are pressed --- src/Sequencer.h | 10 ++++++---- src/src.ino | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Sequencer.h b/src/Sequencer.h index 88ec150..6abe30f 100644 --- a/src/Sequencer.h +++ b/src/Sequencer.h @@ -14,6 +14,7 @@ uint8_t step_note[] = { 1,0,6,9,0,4,0,5 }; uint8_t step_enable[] = { 1,0,1,1,1,1,0,1 }; uint8_t step_velocity[] = { 100,100,100,100,100,100,100,100 }; uint8_t step_delay[] = { 0,0,0,0,0,0,0,0 }; +uint8_t step_random[] = { 0,0,0,0,0,0,0,0 }; uint8_t num_steps_used = SEQUENCER_NUM_STEPS; void sequencer_init(); @@ -153,9 +154,7 @@ void sequencer_advance_without_play() { current_step = next_step; update_next_step(); - if (!next_step_is_random && !random_flag) { - random_offset = 0; - } else { + if (next_step_is_random || random_flag || step_random[current_step]) { random_flag = false; random_offset = random(num_steps_used); // select random step from the used steps @@ -168,6 +167,8 @@ void sequencer_advance_without_play() { } } } + } else { + random_offset = 0; } // Sample keys @@ -185,7 +186,8 @@ void sequencer_advance_without_play() { arpeggio_index++; } step_enable[current_step] = 1; - step_velocity[current_step] = INITIAL_VELOCITY; + step_velocity[current_step] = INITIAL_VELOCITY; + step_random[current_step] = 0; } } diff --git a/src/src.ino b/src/src.ino index 1f9809e..b48abe3 100644 --- a/src/src.ino +++ b/src/src.ino @@ -282,9 +282,11 @@ void keys_scan() { step_enable[k-STEP_1] = 1; num_steps_used++; step_delay[k-STEP_1] = 0; + step_random[k-STEP_1] = 0; } else if (step_enable[k-STEP_1] == 0) { step_enable[k-STEP_1] = 1; step_delay[k-STEP_1] = 0; + step_random[k-STEP_1] = 0; } else { step_enable[k-STEP_1] = 0; } @@ -311,11 +313,21 @@ void keys_scan() { } else if (k == BTN_UP) { key_up = 1; } else if (k == BTN_SEQ1) { - next_step_is_random = true; - if(!sequencer_is_running) { - sequencer_advance(); + // if step keys are pressed set those steps to random + if (stepkeys) { + for (int i = 0; i < SEQUENCER_NUM_STEPS; i++) { + if (stepkeys & 1<