From 783d5e970c7081eb3758477a420fe6ab1601cde5 Mon Sep 17 00:00:00 2001 From: Seymour Shlien Date: Thu, 21 Jan 2021 10:19:32 -0500 Subject: [PATCH] 2021.01.21 --- VERSION | 2 +- doc/CHANGES | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/readme.txt | 2 +- store.c | 26 ++++++++++++++++--------- 4 files changed, 70 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 6f1bbea..c36e7ed 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2020 December 10 2020 +2021 January 21 2021 diff --git a/doc/CHANGES b/doc/CHANGES index df42712..73fbf4e 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -14020,4 +14020,55 @@ Minor changes to store.c, toabc.c yapstree.c to link to the new functions in parseabc.c +January 21 2021 + +Abc2midi bug: the following tune exposes several problems. + +X:1 +T: voice repeats +M: 4/4 +L: 1/4 +K:C +[V:1] C2E2 | +[V:2] C,4 | +[V:1] D2F2 & f4| +[V:2] D,4 | +[V:1] E2G2 :: +[V:2] E,4 :: +[V:1]d2B2 | +[V:2]B,4 | +[V:1] c2A2| +[V:2] A,4 | +[V:1] B2G2 :|] +[V:2] G,4 :|] + +Running abc2midi produces the following messages. +voice mapping: + 1 2 +writing MIDI file repeats1.mid +Error in line-char 8-10 : Expected end repeat not found at |: +Error in line-char 8-10 : Expected end repeat not found at |: +Warning in line-char 18-10 : Track 2 is 48.054165 quarter notes long not 40.054165 +Error in line-char 10-13 : Found unexpected :: +Warning in line-char 18-11 : Track 3 is 36.054165 quarter notes long not 40.054165 + +The first two error messages do not make sense since it points to +line [V:1] D2F2 & f4| which does not contain a left repeat |: . +Furthermore the double repeat E2G2 :: is ignored and that section is +not repeated causing a loss of synchronization between the two voices +and unequal tracks. + +Analysis: +If we remove the split voice &f4, abc2midi runs without errors. +If instead we put opening repeats |: in the first measure, +[V:1] |: C2E2 | +[V:2] |: C,4 | +abc2midi again runs without errors. + +The problem is caused by a bug in the function add_missing_repeats (store.c) +which is called by scan_for_missing_repeats. After, the first call to +insertfeature, the locations in the array add_leftrepeat_at[] no longer +point directly to the VOICE features but before. (The insertion shifts +everything to the right.) It is necessary to adjust this position by +looking ahead. diff --git a/doc/readme.txt b/doc/readme.txt index df0da8a..b69fb32 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.47 November 01 2020 -abc2midi version 4.45 December 10 2020 +abc2midi version 4.46 January 21 2021 abc2abc version 2.12 October 19 2020 yaps version 1.86 December 10 2020 abcmatch version 1.77 December 10 2020 diff --git a/store.c b/store.c index 92ccced..0d34c91 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.45 December 20 2020 abc2midi" +#define VERSION "4.46 January 21 2021 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -5957,7 +5957,7 @@ for (i=0;i3) printf("scan_for_missing_repeats finished\n"); void add_missing_repeats () { -int i,j; +int i,j,k; +int leftrepeat; for (i = num2add-1; i >= 0; i--) { - insertfeature(BAR_REP,0,0,0,add_leftrepeat_at[i]); - /*for (j=0;j add_leftrepeat_at[i])