From 6441b478418350b338589cbfb1b4397fed4a490e Mon Sep 17 00:00:00 2001 From: sshlien Date: Thu, 22 Feb 2024 21:08:16 -0500 Subject: [PATCH] 2024.02.22 --- VERSION | 2 +- doc/CHANGES | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/readme.txt | 2 +- music_utils.c | 12 +++++++++++ parseabc.c | 2 +- store.c | 2 +- 6 files changed, 73 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index ff11a43..a043501 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -February 19 2024 +February 22 2024 diff --git a/doc/CHANGES b/doc/CHANGES index 7864ce2..6bdef68 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -15340,3 +15340,60 @@ if (*(p+1) == ':') { The change also has impact on yaps, abc2abc, and abcmatch. + +February 22 2024 + +abc2midi bug + +Adding snm=something after a clef= declaration +removes the offset from the clef. In the following +example, + +X:1 +T: with snm +M:4/4 +L:1/4 +V:1 clef=treble-8 +V:2 clef=treble-8 snm=anything +K:C +[V:1] z z C z | +[V:2] z z z C | + +C in voice 1 is shifted down an octave but C in voice 2 +is untouched. + +Analysis: parsevoice attempts to parse each token (clef=, octave=, +transpose=, sound=, name= and etc.) by calling various functions +parseclef(), parsetranspose(), parseoctave(), and etc.) until it +succeeds. parseclef is thus called on every token and returns either +1 or 0 depending whether it was successful or not. parseclef calls +the function isclef() to do the work. Unfortunately, isclef() +zeros the variable new_clef->octave_offset whether or not a +clef is declared in the token. Therefore the token snm=... +causes new_clef->octave_offset to be zeroed. The next function +which follows, get_extended_clef_details does set the octave_offset, but +it is only called if the token was a clef. + +Fix: commented out the line in isclef() which zeros the octave_offset. + + +February 22 2024 + +abcmidi bug: + +Besides clef=treble-8, the abcmidi 2.2 standard also recognizes +clef=treble_8 which it treats similarly. The standard also allows +clef=treble^8 to be substituted for treble+8. abc2midi does not +recognize these variants. + +Fix: extended the function get_clef_octave_offset in music_utils.c +to recognize these variants. + + + + + + + + + diff --git a/doc/readme.txt b/doc/readme.txt index 8f6b087..de2259e 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.59 February 08 2023 -abc2midi version 4.87 February 19 2024 +abc2midi version 4.88 February 22 2024 abc2abc version 2.21 February 19 2024 yaps version 1.93 February 19 2024 abcmatch version 1.83 February 19 2024 diff --git a/music_utils.c b/music_utils.c index fb1a56b..0ab2507 100644 --- a/music_utils.c +++ b/music_utils.c @@ -205,6 +205,18 @@ static int get_clef_octave_offset (char *clef_ending) if (strncmp (clef_ending, "-15", 2) == 0) { return -2; } + if (strncmp (clef_ending, "^8", 2) == 0) { + return 1; + } + if (strncmp (clef_ending, "^15", 2) == 0) { + return 2; + } + if (strncmp (clef_ending, "_8", 2) == 0) { + return -1; + } + if (strncmp (clef_ending, "_15", 2) == 0) { + return -2; + } return 0; } diff --git a/parseabc.c b/parseabc.c index 56e5898..1fec55f 100644 --- a/parseabc.c +++ b/parseabc.c @@ -688,7 +688,7 @@ int isclef (char *s, cleftype_t * new_clef, int gotclef; gotclef = 0; - new_clef->octave_offset = 0; + /*new_clef->octave_offset = 0; [SS] 2024-02.22 */ gotclef = get_standard_clef (s, new_clef); if (!gotclef && expect_clef) { /* do we have a clef in letter format ? e.g. C1, F3, G3 */ diff --git a/store.c b/store.c index 03ea7f4..b062b74 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.87 February 19 2024 abc2midi" +#define VERSION "4.88 February 22 2024 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1