int32 chord
int32 neckpos
int32 variationH
int32 variationM
int32 variationL
int32 scale
int32 key
int32 El
int32 A
int32 D
int32 G
int32 B
int32 Eh
int note[552] = {
0, 0, 2, 2, 4, 5, 5, 7, 7, 9, 9, 11, // major/ionian scale
0, 0, 2, 2, 4, 5, 5, 7, 8, 8, 11, 11, // major harmonic scale
0, 0, 2, 2, 4, 5, 6, 6, 8, 8, 10, 10, // major locrian scale
0, 0, 2, 2, 4, 5, 5, 7, 7, 9, 9, 10, // mixolydian/adonai malakh scale
0, 0, 2, 2, 4, 4, 7, 7, 9, 9, 11, 11, // pentatonic major scale
0, 0, 0, 3, 3, 5, 5, 7, 7, 7, 10, 10, // pentatonic minor scale
0, 0, 2, 3, 3, 5, 5, 7, 8, 8, 10, 10, // minor/aeolian scale
0, 1, 1, 3, 3, 5, 6, 6, 8, 8, 10, 10, // locrian scale
0, 0, 2, 3, 3, 5, 5, 7, 8, 8, 11, 11, // harmonic minor scale
0, 0, 2, 3, 3, 5, 5, 7, 7, 9, 9, 11, // melodic minor scale UP
0, 0, 2, 3, 3, 5, 5, 7, 7, 8, 8, 10, // melodic minor scale DOWN
0, 0, 2, 3, 3, 5, 6, 6, 8, 9, 9, 11, // diminished scale
0, 0, 0, 3, 4, 4, 4, 7, 8, 8, 8, 11, // augmented scale
0, 0, 2, 2, 4, 4, 6, 6, 8, 9, 9, 11, // augmented lydian scale
0, 1, 1, 4, 5, 5, 7, 7, 8, 8, 10, 10, // phrygian dominant scale
0, 1, 1, 3, 3, 5, 5, 7, 8, 8, 10, 10, // phrygian scale
0, 0, 2, 2, 4, 4, 6, 6, 9, 9, 10, 10, // prometheus scale
0, 0, 2, 2, 4, 4, 6, 7, 7, 9, 10, 10, // acoustic scale
// algerian scale
0, 1, 1, 3, 4, 4, 6, 6, 8, 8, 10, 10, // altered scale
0, 0, 2, 2, 4, 5, 5, 7, 8, 9, 9, 11, // major bebop
0, 0, 2, 2, 4, 5, 5, 7, 7, 9, 10, 11, // bebop scale
0, 0, 0, 4, 4, 5, 6, 7, 7, 7, 10, 10, // blues scale
0, 0, 2, 3, 3, 5, 5, 7, 7, 9, 10, 10, // dorian scale
0, 0, 2, 3, 3, 3, 6, 7, 7, 9, 10, 10, // ukrainian dorian scale
0, 1, 1, 1, 4, 5, 5, 7, 8, 8, 8, 11, // double Harmonic scale
0, 1, 1, 1, 4, 4, 6, 6, 8, 9, 10, 11, // enigmatic scale
0, 1, 1, 1, 4, 5, 5, 7, 8, 8, 8, 10, // flamenco scale
0, 0, 2, 3, 3, 3, 6, 7, 8, 8, 10, 10, // gypsy scale
0, 0, 2, 3, 3, 5, 6, 6, 8, 8, 10, 10, // half-diminished scale
// harmonic scale
0, 0, 3, 3, 4, 5, 5, 7, 7, 9, 9,
9, // scale of harmonics ***needs harmonic adjustment: 1/1 6/5 5/4 4/3
// 3/2 5/3 2/1
0, 0, 0, 4, 4, 4, 6, 6, 7, 7, 11, 11, // hirajoshi scale
0, 0, 2, 3, 3, 6, 6, 7, 8, 8, 11, 11, // hungarian gypsy scale
0, 0, 2, 3, 3, 6, 6, 7, 8, 8, 10, 10, // hungarian minor scale
0, 0, 1, 1, 1, 5, 5, 5, 7, 7, 8, 8, // ln scale
0, 0, 1, 1, 5, 5, 5, 7, 7, 7, 10, 10, // insen scale
0, 0, 1, 1, 3, 3, 4, 4, 6, 6, 7, 7, // istrian scale
0, 0, 1, 1, 1, 5, 5, 6, 6, 6, 10, 10, // iwatso scale
0, 1, 1, 3, 3, 5, 5, 7, 8, 8, 11, 11, // neapolitian minor scale
0, 1, 1, 3, 4, 4, 6, 7, 7, 9, 10, 10, // octatonic bass scale
0, 0, 2, 3, 3, 5, 6, 6, 8, 9, 9, 10, // octatonic melody scale
0, 1, 1, 3, 3, 3, 6, 7, 8, 8, 10,
10, // pelog scale ***prob needs detuning on 1,3,6 and
// 10, +,-,-,+ respectively***
0, 1, 1, 1, 4, 5, 6, 6, 8, 8, 10, 10, // persian scale
0, 0, 2, 2, 2, 5, 5, 7, 7, 7, 9,
9, // slendro scale ***prob needs detuning on
// 2,5,7 and 9, +,-,+,+ respectively***
0, 1, 1, 4, 4, 6, 6, 7, 7, 7, 10, 10, // tri tone scale
0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, // whole tone scale
0, 0, 0, 3, 3, 5, 5, 7, 7, 7, 10, 10, // yo scale
};
int var[6];
int chord[42] = {0, 3, 2, 0, 1, 0, 0, 0, 0, 2, 3, 1, 0, 2, 2, 0, 0, 0, 1, 0, 3,
2, 1, 1, 3, 2, 0, 0, 0, 1, 0, 0, 2, 2, 1, 0, 0, 2, 3, 4, 3, 0};
int vaL = inlet_variationL & 3;
int nxtL = inlet_variationL >> 2;
int vaM = inlet_variationM & 3;
int nxtM = inlet_variationM >> 2;
int vaH = inlet_variationH & 3;
int nxtH = inlet_variationH >> 2;
var[1] = (vaL & 1) * 2 + nxtL * 4;
var[2] = (vaL & 3) * 2 + nxtL * 4;
var[3] = (vaM & 1) * 2 + nxtM * 4;
var[4] = (vaM & 3) * 2 + nxtM * 4;
var[5] = (vaH & 1) * 2 + nxtH * 4;
var[6] = (vaH & 3) * 2 + nxtH * 4;
int key;
key = inlet_key * 7;
int scale = inlet_scale - (scale / 46) * 46;
scale = scale * 12;
key = key - (key / 12) * 12;
key = key < 0 ? key + 12 : key;
int32_t Chord = inlet_chord;
Chord = Chord - (Chord / 7) * 7;
Chord = Chord < 0 ? Chord + 7 : Chord;
int pos1 = inlet_neckpos + 7 + var[0] - key + chord[Chord * 6];
int oct1 = (pos1 / 12);
oct1 = oct1 < 0 ? oct1 + 1 : oct1;
pos1 = pos1 - oct1 * 12;
int pos2 = inlet_neckpos + 12 + var[1] - key + chord[Chord * 6 + 1];
int oct2 = (pos2 / 12);
oct2 = oct2 < 0 ? oct2 + 1 : oct2;
pos2 = pos2 - oct2 * 12;
int pos3 = inlet_neckpos + 17 + var[2] - key + chord[Chord * 6 + 2];
int oct3 = (pos3 / 12);
oct3 = oct3 < 0 ? oct3 + 1 : oct3;
pos3 = pos3 - oct3 * 12;
int pos4 = inlet_neckpos + 22 + var[3] - key + chord[Chord * 6 + 3];
int oct4 = (pos4 / 12);
oct4 = oct4 < 0 ? oct4 + 1 : oct4;
pos4 = pos4 - oct4 * 12;
int pos5 = inlet_neckpos + 26 + var[4] - key + chord[Chord * 6 + 4];
int oct5 = (pos5 / 12);
oct5 = oct5 < 0 ? oct5 + 1 : oct5;
pos5 = pos5 - oct5 * 12;
int pos6 = inlet_neckpos + 31 + var[5] - key + chord[Chord * 6 + 5];
int oct6 = (pos6 / 12);
oct6 = oct6 < 0 ? oct6 + 1 : oct6;
pos6 = pos6 - oct6 * 12;
if ((scale > 0) & (scale < 4)) {
key -= 3;
}
if (scale > 3) {
key -= 3;
}
outlet_El = note[pos1 + scale] + oct1 * 12 + key;
outlet_A = note[pos2 + scale] + oct2 * 12 + key;
outlet_D = note[pos3 + scale] + oct3 * 12 + key;
outlet_G = note[pos4 + scale] + oct4 * 12 + key;
outlet_B = note[pos5 + scale] + oct5 * 12 + key;
outlet_Eh = note[pos6 + scale] + oct6 * 12 + key;