diff --git a/VERSION b/VERSION index e18f278..b0ff5f5 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2021 March 27 2021 +2021 March 30 2021 diff --git a/doc/CHANGES b/doc/CHANGES index c6e3fc3..4dd5780 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -14136,3 +14136,19 @@ should be +March 30 2021 +abc2midi bug: though grace notes only contain notes, the syntax allows +you to substitute chords for grace notes. For example, + +X:1 +T:acc +M:4/4 +L:1/4 +K:G +[DF]|E {[bc]}B cd|D4| + +The function applygrace_new (in store.c) was modified so that the two notes +in the chord [bc] are treated as if they were one note. Otherwise +the measure would be too short (B is shrunk to make room for b and c) +and there could be a loss of synchronization between the voices. + diff --git a/doc/readme.txt b/doc/readme.txt index d4823e8..4245cc8 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.50 March 10 2021 +abc2midi version 4.51 March 30 2021 abc2abc version 2.12 October 19 2020 yaps version 1.86 December 10 2020 abcmatch version 1.78 March 27 2021 diff --git a/store.c b/store.c index 8f8a3fe..f0b17c0 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.50 March 10 2021 abc2midi" +#define VERSION "4.51 March 30 2021 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -5245,7 +5245,9 @@ int place; int nextinchord; int hostnotestart, hostnoteend; int adjusted_num, adjusted_den; + int notesinchord; + notesinchord = -1; j = place; start = -1; while ((j < notes) && (start == -1)) { @@ -5307,11 +5309,26 @@ int place; grace_denom = 1; p = start; while (p <= end) { - if ((feature[p] == NOTE) || (feature[p] == REST)) { - grace_num = grace_num * denom[p] + grace_denom * num[p]; - grace_denom = grace_denom * denom[p]; - reduce(&grace_num, &grace_denom); - }; + switch(feature[p]) { /* [SS] 2021-03-30 */ + case NOTE: + case REST: + if (notesinchord <= 0) { + /* if chordal grace note, only count the first note */ + grace_num = grace_num * denom[p] + grace_denom * num[p]; + grace_denom = grace_denom * denom[p]; + reduce(&grace_num, &grace_denom); + if (notesinchord == 0) notesinchord++; + } + break; + case CHORDON: + notesinchord = 0; + break; + case CHORDOFF: + notesinchord = -1; + break; + default: + break; + } p = p + 1; };