Skip to content

Commit

Permalink
Feature: Chord3 - Replacement (root, inv I, inv II)
Browse files Browse the repository at this point in the history
- root, inv I and inv II usage
  • Loading branch information
rio-rattenrudel committed Nov 14, 2019
1 parent 703445c commit a784a9f
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 118 deletions.
251 changes: 145 additions & 106 deletions apps/sequencers/midibox_seq_v4/core/seq_chord.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,114 +117,145 @@ static const seq_chord_entry_t seq_chord_table[2][32] = {
}
};

//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################

static const seq_chord_entry_t seq_chord3_table[] = {
// 1 2 3 4 5 6 <----> (6 chars!)
{{-1, -1, -1, -1, -1, -1 }, " ---- " },
{{ 0, 7, -1, -1, -1, -1 }, "pwr5 "},
{{ 0, 7, 12, -1, -1, -1 }, "pwr8 "},
{{ 0, 4, 7, -1, -1, -1 }, "Maj "},
{{ 4, 7, 12, -1, -1, -1 }, "M1inv "},
{{ 7, 12, 16, -1, -1, -1 }, "M2inv "},
{{ 4, 12, 19, -1, -1, -1 }, "drp3 "},
{{ 7, 12, 16, -1, -1, -1 }, "drp5 "},
{{ 0, 7, 16, -1, -1, -1 }, "top3 "},
{{ 0, 4, 7, 12, 16, -1 }, "MgC "},
{{ 0, 7, 12, 16, -1, -1 }, "MgD "},
{{ 0, 7, 12, 16, 19, 24 }, "MgE "},
{{ 0, 4, 7, 12, 19, 24 }, "MgG "},
{{ 0, 3, 7, -1, -1, -1 }, "Min "},
{{ 3, 7, 12, -1, -1, -1 }, "m1inv "},
{{ 7, 12, 15, -1, -1, -1 }, "m2inv "},
{{ 3, 12, 19, -1, -1, -1 }, "mdr3 "},
{{ 7, 12, 15, -1, -1, -1 }, "mdr5 "},
{{ 0, 7, 15, -1, -1, -1 }, "mtp3 "},
{{ 0, 7, 12, 15, 19, 24 }, "mgEm "},
{{ 0, 7, 17, 15, 19, -1 }, "mgAm "},
{{ 0, 7, 12, 14, -1, -1 }, "mgDm "},
{{ 0, 4, 7, 9, -1, -1 }, "M6r "},
{{ 4, 7, 9, 12, -1, -1 }, "M61 "},
{{ 7, 9, 12, 16, -1, -1 }, "M62 "},
{{ 9, 12, 16, 19, -1, -1 }, "M63 "},
{{ 7, 16, 21, 24, -1, -1 }, "M6g2 "},
{{ 7, 12, 16, 21, -1, -1 }, "M6g3 "},
{{ 0, 9, 28, 31, -1, -1 }, "M6g6 "},
{{ 0, 3, 7, 10, -1, -1 }, "m7r "},
{{ 3, 7, 10, 12, -1, -1 }, "m71 "},
{{ 7, 10, 12, 15, -1, -1 }, "m72 "},
{{10, 12, 15, 19, -1, -1 }, "m73 "},
{{ 0, 7, 10, 15, 22, 24 }, "m7gE "},
{{ 0, 7, 10, 15, 19, 24 }, "m2gA "},
{{ 0, 10, 15, -1, -1, -1 }, "m7g5 "},
{{ 0, 3, 7, 9, -1, -1 }, "m6r "},
{{ 3, 7, 9, 12, -1, -1 }, "m61 "},
{{ 7, 9, 12, 15, -1, -1 }, "m62 "},
{{ 9, 12, 15, 19, -1, -1 }, "m63 "},
{{ 9, 15, 19, 24, -1, -1 }, "m6g2 "},
{{ 0, 9, 15, 19, -1, -1 }, "m5g5 "},
{{ 0, 9, 15, 19, 24, -1 }, "m6g6 "},
{{ 9, 19, 24, 27, -1, -1 }, "m6g2 "},
{{ 0, 3, 6, 10, -1, -1 }, "m7b5r "},
{{ 3, 6, 10, 12, -1, -1 }, "m7b51 "},
{{ 6, 10, 12, 15, -1, -1 }, "m7b52 "},
{{10, 12, 15, 18, -1, -1 }, "m7b53 "},
{{ 0, 7, 10, 12, -1, -1 }, "m7b5g5"},
{{10, 15, 18, 24, -1, -1 }, "m7b6g3"},
{{ 0, 10, 15, 18, -1, -1 }, "m7b5g6"},
{{ 3, 12, 18, 22, -1, -1 }, "m7b5g4"},
{{ 0, 4, 7, 11, -1, -1 }, "Mj7r "},
{{ 4, 7, 11, 12, -1, -1 }, "Mj71 "},
{{ 7, 11, 12, 16, -1, -1 }, "Mj72 "},
{{11, 12, 16, 19, -1, -1 }, "Mj73 "},
{{ 4, 12, 19, 23, -1, -1 }, "Mj7d3 "},
{{ 7, 12, 16, 23, -1, -1 }, "Mj7d5 "},
{{ 0, 7, 11, 16, 19, -1 }, "Mj7g5 "},
{{ 7, 12, 19, 23, 28, 31 }, "Mj7g6 "},
{{ 0, 11, 16, 19, 24, -1 }, "Mj6g6b"},
{{ 7, 12, 16, 23, -1, -1 }, "Mj7g3 "},
{{ 0, 4, 7, 10, -1, -1 }, "7r "},
{{ 4, 7, 10, 12, -1, -1 }, "71 "},
{{ 7, 10, 12, 16, -1, -1 }, "72 "},
{{10, 12, 16, 19, -1, -1 }, "73 "},
{{ 0, 4, 10, 12, 16, -1 }, "7gC "},
{{ 0, 7, 10, 16, -1, -1 }, "7gD "},
{{ 0, 7, 10, 16, 19, 24 }, "7gE "},
{{ 0, 4, 7, 12, 16, 22 }, "7gG "},
{{ 0, 7, 10, 17, 19, -1 }, "7gA "},
{{ 0, 10, 14, -1, -1, -1 }, "7g6 "},
{{ 0, 4, 10, -1, -1, -1 }, "7g5 "},
{{ 0, 3, 7, 14, -1, -1 }, "m9n4 "},
{{ 0, 3, 7, 10, 14, -1 }, "m9n5 "},
{{ 0, 4, 7, 14, -1, -1 }, "Mj9 "},
{{ 0, 4, 7, 11, 14, -1 }, "Mj9 "},
{{ 0, 4, 7, 10, 14, -1 }, "9 "},
{{ 0, 3, 7, 10, 14, 17 }, "m11 "},
{{ 0, 4, 7, 10, 14, 17 }, "11 "},
{{ 0, 4, 7, 11, 14, 21 }, "Mj13 "},
{{ 0, 3, 7, 10, 14, 21 }, "m13 "},
{{ 0, 4, 7, 10, 14, 21 }, "13 "},
{{ 0, 5, 10, -1, -1, -1 }, "ply4 "},
{{ 0, 7, 14, -1, -1, -1 }, "ply5 "},
{{ 0, 3, 6, 9, -1, -1 }, "dim "},
{{ 0, 3, 6, -1, -1, -1 }, "dm3 "},
{{ 0, 5, 7, -1, -1, -1 }, "sus4 "},
{{ 0, 5, 7, 10, -1, -1 }, "7sus "},
{{ 0, 4, 8, -1, -1, -1 }, "+ "},
{{ 0, 4, 8, 10, -1, -1 }, "7+ "},
{{ 0, 3, 7, 11, -1, -1 }, "m(Mj7)"},
{{ 0, 4, 6, 10, -1, -1 }, "7b5 "},
{{ 0, 4, 8, 10, -1, -1 }, "7#5 "},
{{ 0, 4, 7, 10, 13, -1 }, "7b9 "},
{{ 0, 4, 10, 13, -1, -1 }, "7b9 "},
{{ 0, 4, 7, 10, 15, -1 }, "7#9 "},
{{ 0, 4, 10, 15, -1, -1 }, "7#9 "},
{{ 0, 4, 6, 13, -1, -1 }, "7b5b9 "},
{{ 0, 4, 8, 13, -1, -1 }, "7#5b9 "},
{{ 0, 4, 6, 15, -1, -1 }, "7b5#9 "},
{{ 0, 4, 8, 15, -1, -1 }, "7b5b9 "}, // C101
// add additional chords here... (26 free slots)
{{-17, -12, -8, 99, 99, 99 }, "inv II" },
{{-16, -11, -7, 99, 99, 99 }, "inv II" },
{{-15, -10, -6, 99, 99, 99 }, "inv II" },
{{-14, -9, -5, 99, 99, 99 }, "inv II" },
{{-13, -8, -4, 99, 99, 99 }, "inv II" },
{{-12, -7, -3, 99, 99, 99 }, "inv II" },
{{-11, -6, -2, 99, 99, 99 }, "inv II" },
{{-10, -5, -1, 99, 99, 99 }, "inv II" },
{{ -9, -4, 0, 99, 99, 99 }, "inv II" },
{{ -8, -3, 1, 99, 99, 99 }, "inv II" },
{{ -7, -2, 2, 99, 99, 99 }, "inv II" },
{{ -6, -1, 3, 99, 99, 99 }, "inv II" },
{{-12, -8, -5, 99, 99, 99 }, "root " },
{{-11, -7, -4, 99, 99, 99 }, "root " },
{{-10, -6, -3, 99, 99, 99 }, "root " },
{{ -9, -5, -2, 99, 99, 99 }, "root " },
{{ -8, -4, -1, 99, 99, 99 }, "root " },
{{ -7, -3, 0, 99, 99, 99 }, "root " },
{{ -6, -2, 1, 99, 99, 99 }, "root " },
{{ -5, -1, 2, 99, 99, 99 }, "root " },
{{ -4, 0, 3, 99, 99, 99 }, "root " },
{{ -3, 1, 4, 99, 99, 99 }, "root " },
{{ -2, 2, 5, 99, 99, 99 }, "root " },
{{ -1, 3, 6, 99, 99, 99 }, "root " },
{{ -8, -5, 0, 99, 99, 99 }, "inv I " },
{{ -7, -4, 1, 99, 99, 99 }, "inv I " },
{{ -6, -3, 2, 99, 99, 99 }, "inv I " },
{{ -5, -2, 3, 99, 99, 99 }, "inv I " },
{{ -4, -1, 4, 99, 99, 99 }, "inv I " },
{{ -3, 0, 5, 99, 99, 99 }, "inv I " },
{{ -2, 1, 6, 99, 99, 99 }, "inv I " },
{{ -1, 2, 7, 99, 99, 99 }, "inv I " },
{{ 0, 3, 8, 99, 99, 99 }, "inv I " },
{{ 1, 4, 9, 99, 99, 99 }, "inv I " },
{{ 2, 5, 10, 99, 99, 99 }, "inv I " },
{{ 3, 6, 11, 99, 99, 99 }, "inv I " },
{{ -5, 0, 4, 99, 99, 99 }, "inv II" },
{{ -4, 1, 5, 99, 99, 99 }, "inv II" },
{{ -3, 2, 6, 99, 99, 99 }, "inv II" },
{{ -2, 3, 7, 99, 99, 99 }, "inv II" },
{{ -1, 4, 8, 99, 99, 99 }, "inv II" },
{{ 0, 5, 9, 99, 99, 99 }, "inv II" },
{{ 1, 6, 10, 99, 99, 99 }, "inv II" },
{{ 2, 7, 11, 99, 99, 99 }, "inv II" },
{{ 3, 8, 12, 99, 99, 99 }, "inv II" },
{{ 4, 9, 13, 99, 99, 99 }, "inv II" },
{{ 5, 10, 14, 99, 99, 99 }, "inv II" },
{{ 6, 11, 15, 99, 99, 99 }, "inv II" },
{{ 0, 4, 7, 99, 99, 99 }, "root " }, // C E G root C
{{ 1, 5, 8, 99, 99, 99 }, "root " }, // C# F G# root C#
{{ 2, 6, 9, 99, 99, 99 }, "root " }, // D F# A root D
{{ 3, 7, 10, 99, 99, 99 }, "root " }, // D# G A# root D#
{{ 4, 8, 11, 99, 99, 99 }, "root " }, // E G# B root E
{{ 5, 9, 12, 99, 99, 99 }, "root " }, // F A C root F
{{ 6, 10, 13, 99, 99, 99 }, "root " }, // F# A# C# root F#
{{ 7, 11, 14, 99, 99, 99 }, "root " }, // G B D root G
{{ 8, 12, 15, 99, 99, 99 }, "root " }, // G# C D# root G#
{{ 9, 13, 16, 99, 99, 99 }, "root " }, // A C# E root A
{{ 10, 14, 17, 99, 99, 99 }, "root " }, // A# D F root A#
{{ 11, 15, 18, 99, 99, 99 }, "root " }, // B D# F# root B
{{ 4, 7, 12, 99, 99, 99 }, "inv I " },
{{ 5, 8, 13, 99, 99, 99 }, "inv I " },
{{ 6, 9, 14, 99, 99, 99 }, "inv I " },
{{ 7, 10, 15, 99, 99, 99 }, "inv I " },
{{ 8, 11, 16, 99, 99, 99 }, "inv I " },
{{ 9, 12, 17, 99, 99, 99 }, "inv I " },
{{ 10, 13, 18, 99, 99, 99 }, "inv I " },
{{ 11, 14, 19, 99, 99, 99 }, "inv I " },
{{ 12, 15, 20, 99, 99, 99 }, "inv I " },
{{ 13, 16, 21, 99, 99, 99 }, "inv I " },
{{ 14, 17, 22, 99, 99, 99 }, "inv I " },
{{ 15, 18, 23, 99, 99, 99 }, "inv I " },
{{ 7, 12, 16, 99, 99, 99 }, "inv II" },
{{ 8, 13, 17, 99, 99, 99 }, "inv II" },
{{ 9, 14, 18, 99, 99, 99 }, "inv II" },
{{ 10, 15, 19, 99, 99, 99 }, "inv II" },
{{ 11, 16, 20, 99, 99, 99 }, "inv II" },
{{ 12, 17, 21, 99, 99, 99 }, "inv II" },
{{ 13, 18, 22, 99, 99, 99 }, "inv II" },
{{ 14, 19, 23, 99, 99, 99 }, "inv II" },
{{ 15, 20, 24, 99, 99, 99 }, "inv II" },
{{ 16, 21, 25, 99, 99, 99 }, "inv II" },
{{ 17, 22, 26, 99, 99, 99 }, "inv II" },
{{ 18, 23, 27, 99, 99, 99 }, "inv II" },
{{ 12, 16, 19, 99, 99, 99 }, "root " },
{{ 13, 17, 20, 99, 99, 99 }, "root " },
{{ 14, 18, 21, 99, 99, 99 }, "root " },
{{ 15, 19, 22, 99, 99, 99 }, "root " },
{{ 16, 20, 23, 99, 99, 99 }, "root " },
{{ 17, 21, 24, 99, 99, 99 }, "root " },
{{ 18, 22, 25, 99, 99, 99 }, "root " },
{{ 19, 23, 26, 99, 99, 99 }, "root " },
{{ 20, 24, 27, 99, 99, 99 }, "root " },
{{ 21, 25, 28, 99, 99, 99 }, "root " },
{{ 22, 26, 29, 99, 99, 99 }, "root " },
{{ 23, 27, 30, 99, 99, 99 }, "root " },
{{ 16, 19, 24, 99, 99, 99 }, "inv I " },
{{ 17, 20, 25, 99, 99, 99 }, "inv I " },
{{ 18, 21, 26, 99, 99, 99 }, "inv I " },
{{ 19, 22, 27, 99, 99, 99 }, "inv I " },
{{ 20, 23, 28, 99, 99, 99 }, "inv I " },
{{ 21, 24, 29, 99, 99, 99 }, "inv I " },
{{ 22, 25, 30, 99, 99, 99 }, "inv I " },
{{ 23, 26, 31, 99, 99, 99 }, "inv I " },
{{ 24, 27, 32, 99, 99, 99 }, "inv I " },
{{ 25, 28, 33, 99, 99, 99 }, "inv I " },
{{ 26, 29, 34, 99, 99, 99 }, "inv I " },
{{ 27, 30, 35, 99, 99, 99 }, "inv I " },
{{ 19, 24, 28, 99, 99, 99 }, "inv II" },
{{ 20, 25, 29, 99, 99, 99 }, "inv II" },
{{ 21, 26, 30, 99, 99, 99 }, "inv II" },
{{ 22, 27, 31, 99, 99, 99 }, "inv II" },
{{ 23, 28, 32, 99, 99, 99 }, "inv II" },
{{ 24, 29, 33, 99, 99, 99 }, "inv II" },
{{ 25, 30, 34, 99, 99, 99 }, "inv II" },
{{ 26, 31, 35, 99, 99, 99 }, "inv II" },
{{ 27, 32, 36, 99, 99, 99 }, "inv II" },
{{ 28, 33, 37, 99, 99, 99 }, "inv II" },
{{ 29, 34, 38, 99, 99, 99 }, "inv II" },
{{ 30, 35, 39, 99, 99, 99 }, "inv II" },
{{ 24, 28, 31, 99, 99, 99 }, "root " },
{{ 25, 29, 32, 99, 99, 99 }, "root " },
{{ 26, 30, 33, 99, 99, 99 }, "root " },
{{ 27, 31, 34, 99, 99, 99 }, "root " },
{{ 28, 32, 35, 99, 99, 99 }, "root " },
{{ 29, 33, 36, 99, 99, 99 }, "root " },
{{ 30, 34, 37, 99, 99, 99 }, "root " },
{{ 31, 35, 38, 99, 99, 99 }, "root " }, // C127
};

//###########################
//# RIO: END MODIFICATION
//###########################

/////////////////////////////////////////////////////////////////////////////
// Initialisation
Expand Down Expand Up @@ -286,17 +317,25 @@ s32 SEQ_CHORD_NoteGet(u8 key_num, u8 chord_set, u8 chord)
s32 note = 0;
s32 oct_transpose = 0;

//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################
if( chord_set == 2 ) {
note = (s32)seq_chord3_table[chord].keys[key_num];

if( note == 99 ) return -1;

} else {
u8 chord_ix = chord & 0x1f;
oct_transpose = (chord >> 5) - 2;

note = (s32)seq_chord_table[chord_set][chord_ix].keys[key_num];
}

if( note < 0 )
return note;
if( note < 0 ) return -1;
}
//###########################
//# RIO: END MODIFICATION
//###########################

// add C-2
note += 0x30;
Expand Down
58 changes: 46 additions & 12 deletions apps/sequencers/midibox_seq_v4/core/seq_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,37 @@ s32 SEQ_LCD_PrintNote(u8 note)
}


//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################
s32 SEQ_LCD_PrintChord3(u8 value)
{
const char note_tab[12][3] = { "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-" };

if( value == 0 ) SEQ_LCD_PrintString("---");
else {
u8 octave = (value + 24) / 36;
u8 area = value / 12;
u8 note = value % 12;

SEQ_LCD_PrintChar(note_tab[note][0]);

if (note_tab[note][1] == '-') {
if (area == 0 || area == 3 || area == 6 || area == 9) SEQ_LCD_PrintChar('\"');
else if (area == 2 || area == 5 || area == 8) SEQ_LCD_PrintChar('\'');
else SEQ_LCD_PrintChar('=');
} else SEQ_LCD_PrintChar('#');

SEQ_LCD_PrintChar('0' + octave);
}

return 0; // no error
}
//###########################
//# RIO: END MODIFICATION
//###########################


/////////////////////////////////////////////////////////////////////////////
// prints an arp event (3 characters)
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -753,11 +784,14 @@ s32 SEQ_LCD_PrintLayerValue(u8 track, u8 par_layer, u8 par_value)

case SEQ_PAR_Type_Chord3: {
if( par_value ) {
if( par_value < 100 ) {
SEQ_LCD_PrintFormattedString("Ch%2d", par_value);
} else {
SEQ_LCD_PrintFormattedString("C%3d", par_value);
}
//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################
SEQ_LCD_PrintChord3(par_value);
SEQ_LCD_PrintChar(' ');
//###########################
//# RIO: END MODIFICATION
//###########################
} else {
SEQ_LCD_PrintString("----");
}
Expand Down Expand Up @@ -910,13 +944,13 @@ s32 SEQ_LCD_PrintLayerEvent(u8 track, u8 step, u8 par_layer, u8 instrument, u8 s

if( par_value && (print_edit_value >= 0 || print_without_gate || SEQ_TRG_GateGet(track, step, instrument)) ) {
if( layer_type == SEQ_PAR_Type_Chord3 ) {
if( par_value < 10 ) {
SEQ_LCD_PrintFormattedString("Ch%d", par_value);
} else if( par_value < 100 ) {
SEQ_LCD_PrintFormattedString("C%2d", par_value);
} else {
SEQ_LCD_PrintFormattedString("%3d", par_value);
}
//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################
SEQ_LCD_PrintChord3(par_value);
//###########################
//# RIO: END MODIFICATION
//###########################
} else {
u8 chord_ix = par_value & 0x1f;
u8 chord_char = ((chord_ix >= 0x10) ? 'a' : 'A') + (chord_ix & 0xf);
Expand Down
7 changes: 7 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ extern s32 SEQ_LCD_PrintVBar(u8 value);
extern s32 SEQ_LCD_PrintHBar(u8 value);
extern s32 SEQ_LCD_PrintLongHBar(u8 value);
extern s32 SEQ_LCD_PrintNote(u8 note);
//###########################
//# RIO: CHORD 3 REPLACEMENT
//###########################
extern s32 SEQ_LCD_PrintChord3(u8 value);
//###########################
//# RIO: END MODIFICATION
//###########################
extern s32 SEQ_LCD_PrintArp(u8 note);
extern s32 SEQ_LCD_PrintGatelength(u8 len);
extern s32 SEQ_LCD_PrintProbability(u8 probability);
Expand Down

0 comments on commit a784a9f

Please sign in to comment.