mirror of
https://github.com/sshlien/abcmidi.git
synced 2026-04-15 22:33:42 +00:00
2021.01.21
This commit is contained in:
51
doc/CHANGES
51
doc/CHANGES
@@ -14020,4 +14020,55 @@ Minor changes to store.c, toabc.c yapstree.c to link to the
|
|||||||
new functions in parseabc.c
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
abcMIDI : abc <-> MIDI conversion utilities
|
abcMIDI : abc <-> MIDI conversion utilities
|
||||||
|
|
||||||
midi2abc version 3.47 November 01 2020
|
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
|
abc2abc version 2.12 October 19 2020
|
||||||
yaps version 1.86 December 10 2020
|
yaps version 1.86 December 10 2020
|
||||||
abcmatch version 1.77 December 10 2020
|
abcmatch version 1.77 December 10 2020
|
||||||
|
|||||||
24
store.c
24
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 */
|
/* enables reading V: indication in header */
|
||||||
#define XTEN1 1
|
#define XTEN1 1
|
||||||
@@ -5970,14 +5970,15 @@ for (i=0;i<notes;i++) {
|
|||||||
}
|
}
|
||||||
if (j == VOICE) {
|
if (j == VOICE) {
|
||||||
voicenum = pitch[i];
|
voicenum = pitch[i];
|
||||||
if(!voicestart[voicenum]) voicestart[voicenum] = i;
|
if(!voicestart[voicenum]) {
|
||||||
|
voicestart[voicenum] = i;
|
||||||
|
/*printf("voicestart[%d] = %d\n",voicenum,voicestart[voicenum]);*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (j == BAR_REP) bar_rep_found[voicenum] = 1;
|
if (j == BAR_REP) bar_rep_found[voicenum] = 1;
|
||||||
if ((j == REP_BAR || j == DOUBLE_REP) && (!bar_rep_found[voicenum])) {
|
if ((j == REP_BAR || j == DOUBLE_REP) && (!bar_rep_found[voicenum])) {
|
||||||
/* printf("missing BAR_REP for voice inserted for voice %d part %c\n",voicenum,part); [SS] 2011-04-19 */
|
/* printf("missing BAR_REP for voice inserted for voice %d part %c\n",voicenum,part); [SS] 2011-04-19 */
|
||||||
/*** add_leftrepeat_at[num2add] = voicestart[voicenum]+3; [SS] 2009-12-20*/
|
add_leftrepeat_at[num2add] = voicestart[voicenum]; /* [SS] 2014-10-31 2021-12-21*/
|
||||||
/***add_leftrepeat_at[num2add] = voicestart[voicenum]+2; /* [SS] 2009-12-20*/
|
|
||||||
add_leftrepeat_at[num2add] = voicestart[voicenum]+1; /* [SS] 2014-10-31*/
|
|
||||||
num2add++;
|
num2add++;
|
||||||
bar_rep_found[voicenum] = 1;
|
bar_rep_found[voicenum] = 1;
|
||||||
}
|
}
|
||||||
@@ -5989,10 +5990,17 @@ if (verbose >3) printf("scan_for_missing_repeats finished\n");
|
|||||||
|
|
||||||
|
|
||||||
void add_missing_repeats () {
|
void add_missing_repeats () {
|
||||||
int i,j;
|
int i,j,k;
|
||||||
|
int leftrepeat;
|
||||||
for (i = num2add-1; i >= 0; i--) {
|
for (i = num2add-1; i >= 0; i--) {
|
||||||
insertfeature(BAR_REP,0,0,0,add_leftrepeat_at[i]);
|
leftrepeat = add_leftrepeat_at[i];
|
||||||
/*for (j=0;j<parts;j++) {*/
|
k=0;
|
||||||
|
/* [SS] 2021-12-21 */
|
||||||
|
while (feature[leftrepeat] != VOICE && k < 20) {
|
||||||
|
leftrepeat++;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
insertfeature(BAR_REP,0,0,0,leftrepeat+1);
|
||||||
/* for (j=0;j<=parts;j++) { [SS] 2011-06-06 */
|
/* for (j=0;j<=parts;j++) { [SS] 2011-06-06 */
|
||||||
for (j=0;j<26;j++) { /* [SS] 2011-08-03 */
|
for (j=0;j<26;j++) { /* [SS] 2011-08-03 */
|
||||||
if (part_start[j] > add_leftrepeat_at[i])
|
if (part_start[j] > add_leftrepeat_at[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user