diff --git a/VERSION b/VERSION index 5ac5b1d..147c9c7 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -January 04 2024 +February 14 2024 diff --git a/doc/CHANGES b/doc/CHANGES index 468b24e..2d6312b 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -15227,3 +15227,90 @@ reported in this file on November 23 2012. The code for handling tied notes is quite intricate and I do not understand it. I am hesitant in tampering with the code. +February 14 2024 + +abc2midi: repeat bug + +For the following example: + +X:1 +T: Repeat bug +M: 1/4 +L: 1/4 +P:A +K:C +P:A +A | B & C :| + +Abc2midi produces a midi file which looks like this +V:1 +A | B | +V:2 +Z | C | Z | C| + +the second voice is repeated by the first voice is not. + +Removing the P:A prior to K:C fixes the problem. +Alternatively, inserting the missing left repeat |: +(eg) |: A | B & C :| +also resolves the problem. + +Apparently, abc2midi does not insert the left repeat in the +correct position. + +Analysis: abc2midi produces an internal representation of the +music using the feature[] array. Since this tune uses split +voices using the & character, the internal representation now +contains two voices. abc2midi then calls scan_for_missing_repeats() +and add_missing_repeats() in store.c in order to insert the missing +left repeats in the internal representation. Unfortunately, +scan_for_missing_repeats puts the left repeat in the wrong place where +it is ineffective. + +The code in scan_for_missing_repeats is quite complicated +because it has to work for either voices or parts. It searches +for either VOICE or PART code in the feature array and inserts +the left repeat immediately following this code. If both +VOICE and PART are present, VOICE should immediately follow PART +in order that scan_for_missing_repeats works correctly. Unfortunately, +they occur in the opposite order. The function event_split_voice() +inserts the VOICE code in the wrong position, mainly because +the v1index address is incorrect. + +Fix: event_part() in store.c, I added the line +v1index = notes; /* [SS] 2024-02-14 */ +following +addfeature(PART, (int)*p, 0, 0); + +This appears to resolve this issue. + + +abc2midi: another related repeat bug + +For the following example: + +X:1 +T: A related repeat bug +P:A +M:3/4 +L:1/4 +K:D +P:X +Z | zzz & b'b'b' :| +P:A +CCC | DDD :| + +abc2midi produces incorrect output for this file. It does not +insert the left repeats in the right place in its internal +representation. + +Fix: for the present time you need to put the left repeats in the +file like this. + +|:Z | zzz & b'b'b' :| +P:A +|:CCC | DDD :| + + + + diff --git a/doc/readme.txt b/doc/readme.txt index 0b30969..d9164f0 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.85 December 23 2023 +abc2midi version 4.86 February 13 2024 abc2abc version 2.20 February 07 2023 yaps version 1.92 January 06 2023 abcmatch version 1.82 June 14 2022 diff --git a/store.c b/store.c index 06f314a..ed858cd 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.85 December 23 2023 abc2midi" +#define VERSION "4.86 February 14 2024 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -2946,6 +2946,7 @@ char* s; part_start[(int)*p - (int)'A'] = notes; addfeature(PART, (int)*p, 0, 0); checkbreak(); + v1index = notes; /* [SS] 2024-02-14 */ v = getvoicecontext(1); } else { parts = 0;