Index: pitchspelling.cpp =================================================================== --- pitchspelling.cpp (Revision 3785) +++ pitchspelling.cpp (Arbeitskopie) @@ -672,28 +672,57 @@ int step = pitch % 12; // ======TODO: fill table with reasonable values =========== + // I've made two tables + // in the first, when gived a cromatic scale, starting on the keynote + // (tonic), it comes out as following: + // 1 1# 2 2# 3 4 4# 5 5# 6 7b 7 8 + // this is transposed to all major modes + static int ptab1[15][12] = { +// c c# d d# e f f# g g# a a# b + { 14, 9, 16, 11, 6, 13, 8, 15, 10, 5, 12, 7 }, // Ces + { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // Ges + { 14, 9, 16, 11, 18, 13, 8, 15, 10, 17, 12, 7 }, // Des + { 14, 9, 16, 11, 18, 13, 8, 15, 10, 17, 12, 19 }, // As + { 14, 9, 16, 11, 18, 13, 20, 15, 10, 17, 12, 19 }, // Es + { 14, 21, 16, 11, 18, 13, 20, 15, 10, 17, 12, 19 }, // B + { 14, 21, 16, 11, 18, 13, 20, 15, 22, 17, 12, 19 }, // F - static int ptab[15][12] = { + { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 12, 19 }, // C + + { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // G + { 14, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // D + { 26, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // A + { 26, 21, 16, 23, 18, 25, 20, 27, 22, 17, 24, 19 }, // E + { 26, 21, 28, 23, 18, 25, 20, 27, 22, 17, 24, 19 }, // H + { 26, 21, 28, 23, 18, 25, 20, 27, 22, 29, 24, 19 }, // Fis + { 26, 21, 28, 23, 30, 25, 20, 27, 22, 29, 24, 19 }, // Cis + }; + + // second table: + // maybe it's better two have a dimished 3rd, rather than + // a augmented 2nd, so this is like: + // 1 1# 2 3b 3 4 4# 5 5# 6 7b 7 8 + static int ptab2[15][12] = { // c c# d d# e f f# g g# a a# b - { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // Ces - { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // Ges + { 14, 9, 4, 11, 6, 13, 8, 15, 10, 5, 12, 7 }, // Ces + { 14, 9, 16, 11, 6, 13, 8, 15, 10, 5, 12, 7 }, // Ges { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // Des - { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // As - { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // Es - { 14, 9, 16, 11, 6, 13, 8, 15, 10, 17, 12, 7 }, // B - { 14, 9, 16, 11, 18, 13, 8, 15, 10, 17, 12, 7 }, // F + { 14, 9, 16, 11, 18, 13, 8, 15, 10, 17, 12, 7 }, // As + { 14, 9, 16, 11, 18, 13, 8, 15, 10, 17, 12, 19 }, // Es + { 14, 9, 16, 11, 18, 13, 20, 15, 10, 17, 12, 19 }, // B + { 14, 21, 16, 11, 18, 13, 20, 15, 10, 17, 12, 19 }, // F - { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // C + { 14, 21, 16, 11, 18, 13, 20, 15, 22, 17, 12, 19 }, // C - { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // G + { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 12, 19 }, // G { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // D - { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // A - { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // E - { 14, 21, 16, 23, 18, 13, 20, 15, 22, 17, 24, 19 }, // H - { 14, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // Fis - { 26, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // Cis + { 14, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // A + { 26, 21, 16, 23, 18, 25, 20, 15, 22, 17, 24, 19 }, // E + { 26, 21, 16, 23, 18, 25, 20, 27, 22, 17, 24, 19 }, // H + { 26, 21, 28, 23, 18, 25, 20, 27, 22, 17, 24, 19 }, // Fis + { 26, 21, 28, 23, 18, 25, 20, 27, 22, 29, 24, 19 }, // Cis }; // printf("pitch2tpc %d(%d) %d = %d\n", pitch, step, key, ptab[key+7][step]); - return ptab[key+7][step]; + return ptab2[key+7][step]; }