Dateien hochladen nach „“

pull/75/head
positionhigh 3 years ago
parent 1b60989609
commit 42cf9d3d1d
  1. 60
      sequencer.cpp
  2. 16
      sequencer.h

@ -47,48 +47,46 @@ void sequencer_part1(void)
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_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_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
}
if (seq_track_type[d] == 2 ) //Chords
else if (seq_track_type[d] == 2 ) //Chords
{
if (seq_vel[ seq_patternchain[seq_chain_active_step][d]][seq_step] > 199)
{
handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_chord_velocity); // basenote
//handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_chord_velocity); // basenote
for (uint8_t x = 0; x < 3; x++) //play chord notes
for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes
{
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][x], seq_chord_velocity);
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12) + seq_arps[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][x], seq_chord_velocity);
}
seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12);
seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
}
}
else if (seq_track_type[d] == 3) { //Arp
if (seq_track_type[d] == 3) { //Arp
arp_step = 0;
arp_counter = 0;
arp_note = seq_data[ 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;
arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12);
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;
}
seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
}
else if (seq_track_type[d] == 3)
// after here not triggered by a key input - arp only
if (seq_track_type[d] == 3)
{ //Arp
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][arp_step] + arp_octave * 12, seq_chord_velocity);
arp_note_prev = arp_note + seq_chords[arp_chord][arp_step] + arp_octave * 12;
{ if (arp_style == 0) { //arp up
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step + seq_element_shift] , seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_step + seq_element_shift] ;
}
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][rnd1] + rnd2, seq_chord_velocity);
arp_note_prev = arp_note + seq_chords[arp_chord][rnd1] + rnd2;
uint8_t rnd1 = random(5);
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord][rnd1] + (seq_oct_shift * 12), seq_chord_velocity);
arp_note_prev = arp_note + seq_chords[arp_chord][rnd1] + (seq_oct_shift * 12);
}
}
}
@ -110,16 +108,14 @@ void sequencer_part1(void)
arp_counter = 0;
arp_step++;
}
}
}
//if (arp_step > 3 || seq_chords[arp_chord][arp_step] == 0 ) {
if (arp_step > 3 || seq_chords[arp_chord][arp_step] == 0 ) {
if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght)
{
arp_step = 0;
arp_octave++;
if (arp_octave >= arp_oct_usersetting) arp_octave = 0;
}
if (seq_step > 15) {
if (seq_step > 15)
{
seq_step = 0;
if (seq_chain_lenght > 0) {
seq_chain_active_step++;
@ -141,10 +137,9 @@ void sequencer_part2(void)
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) {
for (uint8_t x = 0; x < 3; x++) //play chord notes
for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes
{
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][x], 0);
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_arps[seq_prev_vel[d] - 200][x], 0);
}
}
}
@ -158,7 +153,6 @@ void sequencer_part2(void)
}
}
void sequencer(void)
{ // Runs in Interrupt Timer. Switches between the Noteon and Noteoff Task, each cycle

@ -13,6 +13,9 @@ int seq_transpose;
uint8_t seq_inst_dexed[4] = { 0, 0, 1, 1 };
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_chords[7][4] = { 4, 7, 0, 0, //major
3, 7, 0, 0, //minor
@ -22,6 +25,15 @@ uint8_t seq_chords[7][4] = { 4, 7, 0, 0, //major
4, 7, 11, 0, //maj7,
0, 0, 0 , 0 //no Chord
};
uint8_t seq_arps[7][22] = { //up
0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60 ,99,0,0,0,0,0,//major
0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60 ,99,0,0,0,0,0,//minor
0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60 ,99,//seventh
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 ,99,0,0,0,0,0,//augmented
0, 3, 6, 12, 15, 18, 24, 27, 30, 36, 39, 42, 48, 51, 54, 60 ,99,0,0,0,0,0,//dim
0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60 ,99//maj7
};
char seq_chord_names[7][4] = { 'M', 'a', 'j', ' ' , //major
'M', 'i', 'n', ' ' ,
@ -43,7 +55,7 @@ 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 = 0; // 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];
@ -56,7 +68,7 @@ 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 arp_lenght = 8;
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 ,

Loading…
Cancel
Save