mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-16 08:31:02 +00:00
Compare commits
3 Commits
2023.01.10
...
2023.02.07
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c01220de2d | ||
|
|
a5e9382302 | ||
|
|
a9e10a7229 |
37
doc/CHANGES
37
doc/CHANGES
@@ -15037,3 +15037,40 @@ abcmidi: in event_handle_instruction(s), added code to recognize
|
|||||||
!ped(! and !ped)! in addition to !ped! and !ped-up!
|
!ped(! and !ped)! in addition to !ped! and !ped-up!
|
||||||
|
|
||||||
|
|
||||||
|
January 20 2023
|
||||||
|
|
||||||
|
abc2midi: as remarked around June 04-06 2005, split bars and
|
||||||
|
parts were never fully working. For example,
|
||||||
|
|
||||||
|
%%quiet
|
||||||
|
X:1
|
||||||
|
T: split-part
|
||||||
|
M:5/4
|
||||||
|
L:1/8
|
||||||
|
Q:1/4=132
|
||||||
|
P:A6
|
||||||
|
K:none
|
||||||
|
%%MIDI channel 10
|
||||||
|
P:A
|
||||||
|
CDCDC CDCDC & [I:MIDI channel 10] z2E3 E5 |
|
||||||
|
|
||||||
|
does not convert correctly to a midi file.
|
||||||
|
|
||||||
|
Fix: the code in partbreak() seems to have been at fault.
|
||||||
|
The program returns the wrong position of the voice in the
|
||||||
|
feature array, causing the wrong notes to be sent to the
|
||||||
|
active midi track. Permanently eliminating the function
|
||||||
|
fillvoice and always calling findvoice, fixed one of the
|
||||||
|
problems. The second fix was to replace findpart() with
|
||||||
|
findvoice() when the PART feature is encountered. Findvoice()
|
||||||
|
automatically calls findpart(). The external integer array,
|
||||||
|
dependent_voice(), is no longer used and is also eliminated.
|
||||||
|
(See this file December 12 2006.) These changes also appear
|
||||||
|
to fix the bug addressed at the same date.
|
||||||
|
|
||||||
|
|
||||||
|
February 07 2023
|
||||||
|
abc2abc: in toabc.c, James Allwright has introduced a new option -c
|
||||||
|
which replaces /2 with /. He also fixed the -h output in
|
||||||
|
event_init() so that all options are listed.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
abcMIDI : abc <-> MIDI conversion utilities
|
abcMIDI : abc <-> MIDI conversion utilities
|
||||||
|
|
||||||
midi2abc version 3.58 December 09 2022
|
midi2abc version 3.58 December 09 2022
|
||||||
abc2midi version 4.83 January 06 2023
|
abc2midi version 4.84 January 06 2023
|
||||||
abc2abc version 2.19 January 08 2023
|
abc2abc version 2.20 February 07 2023
|
||||||
yaps version 1.92 January 06 2023
|
yaps version 1.92 January 06 2023
|
||||||
abcmatch version 1.82 June 14 2022
|
abcmatch version 1.82 June 14 2022
|
||||||
midicopy version 1.38 May 06 2022
|
midicopy version 1.38 May 06 2022
|
||||||
|
|||||||
62
genmidi.c
62
genmidi.c
@@ -112,7 +112,6 @@ int partrepno;
|
|||||||
int err_num, err_denom;
|
int err_num, err_denom;
|
||||||
|
|
||||||
extern int voicesused;
|
extern int voicesused;
|
||||||
extern int dependent_voice[];
|
|
||||||
|
|
||||||
/* Tempo handling (Q: field) */
|
/* Tempo handling (Q: field) */
|
||||||
extern long tempo;
|
extern long tempo;
|
||||||
@@ -623,56 +622,6 @@ static int findchannel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void fillvoice(partno, xtrack, voice)
|
|
||||||
/* check length of this voice at the end of a part */
|
|
||||||
/* if it is zero, extend it to the correct length */
|
|
||||||
int partno, xtrack, voice;
|
|
||||||
{
|
|
||||||
char msg[100];
|
|
||||||
long now;
|
|
||||||
|
|
||||||
if (partlabel <-1 || partlabel >25) printf("genmidi.c:fillvoice partlabel %d out of range\n",partlabel);
|
|
||||||
|
|
||||||
now = tracklen + delta_time;
|
|
||||||
if (partlabel == -1) {
|
|
||||||
if (xtrack == 1) {
|
|
||||||
introlen = now;
|
|
||||||
} else {
|
|
||||||
if (now == 0) {
|
|
||||||
delta_time = delta_time + introlen;
|
|
||||||
now = introlen;
|
|
||||||
} else {
|
|
||||||
if (now != introlen) {
|
|
||||||
sprintf(msg, "Time 0-%ld voice %d, has length %ld",
|
|
||||||
introlen, voice, now);
|
|
||||||
event_error(msg);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
if (xtrack == 1) {
|
|
||||||
partlen[partlabel] = now - lastlen;
|
|
||||||
} else {
|
|
||||||
if (now - lastlen == 0) {
|
|
||||||
delta_time = delta_time + partlen[partlabel];
|
|
||||||
now = now + partlen[partlabel];
|
|
||||||
} else {
|
|
||||||
if (now - lastlen != partlen[partlabel]) {
|
|
||||||
sprintf(msg, "Time %ld-%ld voice %d, part %c has length %ld",
|
|
||||||
lastlen, lastlen+partlen[partlabel], voice,
|
|
||||||
(char) (partlabel + (int) 'A'),
|
|
||||||
now-lastlen);
|
|
||||||
event_error(msg);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
lastlen = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int findpart(j)
|
static int findpart(j)
|
||||||
int j;
|
int j;
|
||||||
/* find out where next part starts and update partno */
|
/* find out where next part starts and update partno */
|
||||||
@@ -715,13 +664,10 @@ int xtrack, voice, place;
|
|||||||
int newplace;
|
int newplace;
|
||||||
|
|
||||||
newplace = place;
|
newplace = place;
|
||||||
if (dependent_voice[voice]) return newplace;
|
|
||||||
if (xtrack > 0) {
|
|
||||||
fillvoice(partno, xtrack, voice);
|
|
||||||
};
|
|
||||||
if (parts != -1) {
|
if (parts != -1) {
|
||||||
/* go to next part label */
|
/* go to next part label */
|
||||||
newplace = findpart(newplace);
|
newplace = findpart(newplace); /* [SS] 2023.01.20 */
|
||||||
};
|
};
|
||||||
partlabel = (int) pitch[newplace] - (int)'A';
|
partlabel = (int) pitch[newplace] - (int)'A';
|
||||||
return(newplace);
|
return(newplace);
|
||||||
@@ -3239,7 +3185,9 @@ int xtrack;
|
|||||||
break;
|
break;
|
||||||
case PART:
|
case PART:
|
||||||
in_varend = 0;
|
in_varend = 0;
|
||||||
j = partbreak(xtrack, trackvoice, j);
|
/*j = partbreak(xtrack, trackvoice, j); [SS] 2023.01.20 */
|
||||||
|
j = findvoice(j, trackvoice, xtrack);
|
||||||
|
|
||||||
if (parts == -1) {
|
if (parts == -1) {
|
||||||
char msg[1];
|
char msg[1];
|
||||||
|
|
||||||
|
|||||||
6
store.c
6
store.c
@@ -186,7 +186,7 @@ int main()
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSION "4.83 January 10 2023 abc2midi"
|
#define VERSION "4.84 January 20 2023 abc2midi"
|
||||||
|
|
||||||
/* enables reading V: indication in header */
|
/* enables reading V: indication in header */
|
||||||
#define XTEN1 1
|
#define XTEN1 1
|
||||||
@@ -377,7 +377,6 @@ struct trackstruct trackdescriptor[40]; /* trackstruct defined in genmidi.h*/
|
|||||||
|
|
||||||
|
|
||||||
int detune_list[12]; /* [SS] 2020-06-30 */
|
int detune_list[12]; /* [SS] 2020-06-30 */
|
||||||
int dependent_voice[64]; /* flag to indicate type of voice */
|
|
||||||
int voicecount;
|
int voicecount;
|
||||||
int numsplits=0;
|
int numsplits=0;
|
||||||
int splitdepth = 0;
|
int splitdepth = 0;
|
||||||
@@ -1449,7 +1448,6 @@ if (v->fromsplitno == -1) {
|
|||||||
v->octaveshift = octaveshift;
|
v->octaveshift = octaveshift;
|
||||||
v->default_length = default_length; /* [SS] 2010-08-28 */
|
v->default_length = default_length; /* [SS] 2010-08-28 */
|
||||||
}
|
}
|
||||||
dependent_voice[v->indexno] = 1;
|
|
||||||
/* when syncing the split voice we want to be sure that
|
/* when syncing the split voice we want to be sure that
|
||||||
we do not include the notes in the last bar in the source
|
we do not include the notes in the last bar in the source
|
||||||
voice the notes in the split voice take their place.
|
voice the notes in the split voice take their place.
|
||||||
@@ -2977,7 +2975,6 @@ struct voice_params *vp;
|
|||||||
v = getvoicecontext(n);
|
v = getvoicecontext(n);
|
||||||
addfeature(VOICE, v->indexno, 0, 0);
|
addfeature(VOICE, v->indexno, 0, 0);
|
||||||
|
|
||||||
dependent_voice[v->indexno] = 0;
|
|
||||||
if (vp->gotclef)
|
if (vp->gotclef)
|
||||||
{
|
{
|
||||||
event_octave(vp->new_clef.octave_offset, 1);
|
event_octave(vp->new_clef.octave_offset, 1);
|
||||||
@@ -6376,7 +6373,6 @@ char *argv[];
|
|||||||
oldchordconvention = 0; /* for handling +..+ chords */
|
oldchordconvention = 0; /* for handling +..+ chords */
|
||||||
|
|
||||||
for (i=0;i<DECSIZE;i++) decorators_passback[i]=0;
|
for (i=0;i<DECSIZE;i++) decorators_passback[i]=0;
|
||||||
for (i=0;i<64;i++) dependent_voice[i]=0;
|
|
||||||
set_control_defaults();
|
set_control_defaults();
|
||||||
|
|
||||||
event_init(argc, argv, &filename);
|
event_init(argc, argv, &filename);
|
||||||
|
|||||||
39
toabc.c
39
toabc.c
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/* back-end for outputting (possibly modified) abc */
|
/* back-end for outputting (possibly modified) abc */
|
||||||
|
|
||||||
#define VERSION "2.19 Jan 08 2022 abc2abc"
|
#define VERSION "2.20 Feb 07 2023 abc2abc"
|
||||||
|
|
||||||
/* for Microsoft Visual C++ 6.0 or higher */
|
/* for Microsoft Visual C++ 6.0 or higher */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -84,6 +84,7 @@ struct fract breakpoint; /* used to break bar into beamed sets of notes */
|
|||||||
complex_barpoint_t master_bar_break;
|
complex_barpoint_t master_bar_break;
|
||||||
int barno; /* number of bar within tune */
|
int barno; /* number of bar within tune */
|
||||||
int newspacing; /* was -s option selected ? */
|
int newspacing; /* was -s option selected ? */
|
||||||
|
int compact_lengths; /* was -c selected ? [JA] 2023-02-07 */
|
||||||
int have_spacing_scheme; /* do we support spacing for time signature ? [JA] */
|
int have_spacing_scheme; /* do we support spacing for time signature ? [JA] */
|
||||||
int barcheck; /* indicate -b and -r options selected */
|
int barcheck; /* indicate -b and -r options selected */
|
||||||
int echeck; /* was error-checking turned off ? (-e option) */
|
int echeck; /* was error-checking turned off ? (-e option) */
|
||||||
@@ -530,9 +531,13 @@ char** filename;
|
|||||||
|
|
||||||
if ((getarg("-h", argc, argv) != -1) || (argc < 2)) {
|
if ((getarg("-h", argc, argv) != -1) || (argc < 2)) {
|
||||||
printf("abc2abc version %s\n",VERSION);
|
printf("abc2abc version %s\n",VERSION);
|
||||||
printf("Usage: abc2abc <filename> [-s] [-n X] [-b] [-r] [-e] [-t X]\n");
|
printf("Usage: abc2abc <filename> [-s] [-c] [-u] [-n X] [-b] [-r] [-e]\n");
|
||||||
|
printf(" [-t X] [-nda] [-nokeys] [-nokeyf] [-usekey n] [-useclef]\n");
|
||||||
printf(" [-u] [-d] [-v] [-V X[,Y,,,]] [-P X[,Y...]] [-ver] [-X n]\n");
|
printf(" [-u] [-d] [-v] [-V X[,Y,,,]] [-P X[,Y...]] [-ver] [-X n]\n");
|
||||||
|
printf(" [-xref] [-OCC]\n");
|
||||||
printf(" -s for new spacing\n");
|
printf(" -s for new spacing\n");
|
||||||
|
printf(" -c compact note lengths use / instead of /2\n");
|
||||||
|
printf(" -u to update notation ([] for chords and () for slurs)\n");
|
||||||
printf(" -n X to re-format the abc with a new linebreak every X bars\n");
|
printf(" -n X to re-format the abc with a new linebreak every X bars\n");
|
||||||
printf(" -b to remove bar checking\n");
|
printf(" -b to remove bar checking\n");
|
||||||
printf(" -r to remove repeat checking\n");
|
printf(" -r to remove repeat checking\n");
|
||||||
@@ -541,7 +546,6 @@ char** filename;
|
|||||||
printf(" -nda No double accidentals in guitar chords\n");
|
printf(" -nda No double accidentals in guitar chords\n");
|
||||||
printf(" -nokeys No key signature. Use sharps\n");
|
printf(" -nokeys No key signature. Use sharps\n");
|
||||||
printf(" -nokeyf No key signature. Use flats\n");
|
printf(" -nokeyf No key signature. Use flats\n");
|
||||||
printf(" -u to update notation ([] for chords and () for slurs)\n");
|
|
||||||
printf(" -usekey n Use key signature sf (sharps/flats)\n");
|
printf(" -usekey n Use key signature sf (sharps/flats)\n");
|
||||||
printf(" -useclef (treble or bass)\n"); /* [SS] 2020-01-22 */
|
printf(" -useclef (treble or bass)\n"); /* [SS] 2020-01-22 */
|
||||||
printf(" -d to notate with doubled note lengths\n");
|
printf(" -d to notate with doubled note lengths\n");
|
||||||
@@ -576,6 +580,12 @@ char** filename;
|
|||||||
} else {
|
} else {
|
||||||
newspacing = 1;
|
newspacing = 1;
|
||||||
};
|
};
|
||||||
|
/* [JA] 2023-02-07 */
|
||||||
|
if (getarg ("-c", argc, argv) == -1) {
|
||||||
|
compact_lengths = 0;
|
||||||
|
} else {
|
||||||
|
compact_lengths = 1;
|
||||||
|
};
|
||||||
have_spacing_scheme = 0; /* [JA] 2021-05-25 */
|
have_spacing_scheme = 0; /* [JA] 2021-05-25 */
|
||||||
narg = getarg("-X", argc, argv);
|
narg = getarg("-X", argc, argv);
|
||||||
if (narg == -1) {
|
if (narg == -1) {
|
||||||
@@ -1751,30 +1761,19 @@ int explict;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* [JM] 2018-02-22 (add code to treat / and // lengths when
|
|
||||||
SHORT_HALFS is defined during compilation
|
|
||||||
*/
|
|
||||||
static void printlen(a, b)
|
static void printlen(a, b)
|
||||||
int a, b;
|
int a, b;
|
||||||
{
|
{
|
||||||
if (a != 1) {
|
if (a != 1) {
|
||||||
emit_int(a);
|
emit_int(a);
|
||||||
};
|
};
|
||||||
#ifdef SHORT_HALFS
|
|
||||||
else {
|
|
||||||
if (b == 2) {
|
|
||||||
emit_string("/");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (b == 4) {
|
|
||||||
emit_string("//");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (b != 1) {
|
if (b != 1) {
|
||||||
emit_int_sprintf("/%d", b);
|
emit_string ("/");
|
||||||
};
|
/* [JA] 2023-02-07 */
|
||||||
|
if ((!compact_lengths) || (b != 2)) {
|
||||||
|
emit_int (b);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_spacing(n, m)
|
void event_spacing(n, m)
|
||||||
|
|||||||
Reference in New Issue
Block a user