mirror of
https://github.com/sshlien/abcmidi.git
synced 2026-04-17 15:23:41 +00:00
2024.04.30
This commit is contained in:
19
doc/CHANGES
19
doc/CHANGES
@@ -15450,3 +15450,22 @@ d8 |\
|
||||
[V:1 transpose=0] d8 |]
|
||||
|
||||
|
||||
April 30 2024
|
||||
|
||||
According to the abc standards 2.1 and 2.2 the %% (pseudo comment)
|
||||
and the I: (stylesheet directive) should access the same functionality
|
||||
in the same way. Thus if
|
||||
%%MIDI program 10
|
||||
should appear in an I: command as I:MIDI program 10 and not as
|
||||
I:MIDI= program 10. James Allwright has updated abcMIDI C code
|
||||
to comply with the standards. If you need to run some of the older
|
||||
abc files that do not obey this standard and you do not want
|
||||
to edit these files, then you should use an older version of
|
||||
the abcMIDI package.
|
||||
|
||||
The following files were updated: matchsup.c, parseabc.h, pareseabc.c
|
||||
parser2.c, store.c, toabc.c. and yapstree.c. Look for the comments
|
||||
[JA] 2024-04-30.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ Guide to writing abc for abc2midi - minor revision [JA] 2021-05-24
|
||||
|
||||
Updated June 1 2017. %%MIDI program ranges from 0 to 127 not 1 to 128.
|
||||
|
||||
Updated April 30 2024: The [I:MIDI= ..] no longer works. You
|
||||
must use [I:MIDI ...] instead (without the equal sign).
|
||||
|
||||
The abc notation language is described by the version 1.6 specification
|
||||
document and later modifications to this document referred to as
|
||||
version 2.1 and version 2.2. These can be found at abcnotation.com .
|
||||
@@ -1244,12 +1247,12 @@ C2 D2|
|
||||
you can place the MIDI instruction inside an info field
|
||||
using the following syntax.
|
||||
|
||||
A2 B2|[I:MIDI= drumon] C2 D2|
|
||||
A2 B2|[I:MIDI drumon] C2 D2|
|
||||
|
||||
The '=' following the MIDI is very important. The info field
|
||||
syntax allows you to place several MIDI commands in one inline
|
||||
block, for example
|
||||
[I: MIDI = program 73 MIDI=chordprog 29]
|
||||
[I: MIDI program 73 MIDI chordprog 29]
|
||||
(Spaces are optional.)
|
||||
Other examples can be seen in the file CHANGES in the
|
||||
following the March 25 2005 entry.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
abcMIDI : abc <-> MIDI conversion utilities
|
||||
|
||||
midi2abc version 3.59 February 08 2023
|
||||
abc2midi version 4.91 March 02 2024
|
||||
abc2abc version 2.21 February 19 2024
|
||||
yaps version 1.93 February 19 2024
|
||||
abc2midi version 4.92 April 30 2024
|
||||
abc2abc version 2.22 April 30 2024
|
||||
yaps version 1.94 April 30 2024
|
||||
abcmatch version 1.83 February 19 2024
|
||||
midicopy version 1.39 November 08 2022
|
||||
midistats version 0.91 March 21 2024
|
||||
@@ -14,7 +14,7 @@ jamesallwright@yahoo.co.uk
|
||||
University of Westminster,
|
||||
London, UK
|
||||
|
||||
August 2023
|
||||
May 2024
|
||||
Copyright Seymour Shlien
|
||||
fy733@ncf.ca
|
||||
Ottawa, Canada
|
||||
|
||||
4
matchsup.c
Normal file → Executable file
4
matchsup.c
Normal file → Executable file
@@ -422,8 +422,10 @@ char *s;
|
||||
}
|
||||
|
||||
|
||||
void event_specific (package, s)
|
||||
/* [JA] 2024-04-30 added in_I argument */
|
||||
void event_specific (package, s, in_I)
|
||||
char *package, *s;
|
||||
int in_I;
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
2
parseabc.c
Normal file → Executable file
2
parseabc.c
Normal file → Executable file
@@ -2100,7 +2100,7 @@ parse_precomment (s)
|
||||
{
|
||||
p = s + 1;
|
||||
readstr (package, &p, 40);
|
||||
event_specific (package, p);
|
||||
event_specific (package, p, 0); /* [JA] 2024-04-30 */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
6
parseabc.h
Normal file → Executable file
6
parseabc.h
Normal file → Executable file
@@ -116,7 +116,7 @@ extern void event_startmusicline(void);
|
||||
extern void event_endmusicline(char endchar);
|
||||
extern void event_eof(void);
|
||||
extern void event_comment(char *s);
|
||||
extern void event_specific(char *package, char *s);
|
||||
extern void event_specific(char *package, char *s, int in_I);
|
||||
extern void event_specific_in_header(char *package, char *s);
|
||||
extern void event_startinline(void);
|
||||
extern void event_closeinline(void);
|
||||
@@ -133,7 +133,7 @@ extern void event_refno(int n);
|
||||
extern void event_tempo(int n, int a, int b, int rel, char *pre, char *post);
|
||||
extern void event_timesig(timesig_details_t *timesig);
|
||||
extern void event_octave(int num, int local);
|
||||
extern void event_info_key(char *key, char *value);
|
||||
/* extern void event_info_key(char *key, char *value); [JA] 2024-04-30 */
|
||||
extern void event_info(char *s);
|
||||
extern void event_key(int sharps, char *s, int modeindex,
|
||||
char modmap[7], int modmul[7], struct fraction modmicro[7],
|
||||
@@ -203,7 +203,7 @@ extern void event_refno();
|
||||
extern void event_tempo();
|
||||
extern void event_timesig();
|
||||
extern void event_octave();
|
||||
extern void event_info_key();
|
||||
/* extern void event_info_key(); [JA] 2024-04-30 */
|
||||
extern void event_info();
|
||||
extern void event_key();
|
||||
extern void event_microtone();
|
||||
|
||||
92
parser2.c
Normal file → Executable file
92
parser2.c
Normal file → Executable file
@@ -9,89 +9,21 @@
|
||||
#include "parseabc.h"
|
||||
#include "parser2.h"
|
||||
|
||||
void event_info(s)
|
||||
char* s;
|
||||
/* An I: field has been encountered. This routine scans the following
|
||||
text to extract items of the form key=value. The equal sign is optional
|
||||
if only one key (eg MIDI, octave, vol, etc.) occurs in the I: field.
|
||||
Otherwise we need to follow each key with an equal sign so that we
|
||||
know that the preceding item was a key.
|
||||
/* [JA] 2024-04-30 */
|
||||
void event_info(char* s)
|
||||
/* An I: field has been encountered. The 2.1 and 2.2 abc standards
|
||||
specify that this field (stylesheet directive) is handled in the
|
||||
same way as %% (pseudo-comment). If it isn't recognized it should
|
||||
be silently ignored.
|
||||
*/
|
||||
{
|
||||
char* key;
|
||||
char* endkey;
|
||||
char* value;
|
||||
char* endvalue;
|
||||
char* lastendvalue;
|
||||
char* newword;
|
||||
char* lastnewword;
|
||||
char* ptr;
|
||||
int doval;
|
||||
char package[40];
|
||||
char *p;
|
||||
|
||||
ptr = s;
|
||||
doval = 0;
|
||||
while (*ptr != '\0') {
|
||||
if (doval == 0) {
|
||||
/* look for key */
|
||||
skipspace(&ptr);
|
||||
key = ptr;
|
||||
while ((*ptr != '\0') && (*ptr != ' ') && (*ptr != '=')) {
|
||||
ptr = ptr + 1;
|
||||
};
|
||||
endkey = ptr;
|
||||
skipspace(&ptr);
|
||||
if (*ptr == '=') {
|
||||
doval = 1;
|
||||
ptr = ptr + 1;
|
||||
skipspace(&ptr);
|
||||
value = ptr;
|
||||
newword = ptr;
|
||||
endvalue = NULL;
|
||||
lastendvalue = NULL;
|
||||
} else {
|
||||
/* [SS] 2015-09-08 */
|
||||
/* assume only one I: key occurs; grab the rest in value */
|
||||
*endkey = '\0'; /* end the key ptr */
|
||||
value = ptr; /* start the value ptr here */
|
||||
event_info_key(key,value);
|
||||
return;
|
||||
};
|
||||
} else {
|
||||
/* look for value */
|
||||
skipspace(&ptr);
|
||||
while ((*ptr != '\0') && (*ptr != ' ') && (*ptr != '=')) {
|
||||
ptr = ptr + 1;
|
||||
};
|
||||
lastendvalue = endvalue;
|
||||
endvalue = ptr;
|
||||
skipspace(&ptr);
|
||||
lastnewword = newword;
|
||||
newword = ptr;
|
||||
if (*ptr == '\0') {
|
||||
*endkey = '\0';
|
||||
*endvalue = '\0';
|
||||
event_info_key(key, value);
|
||||
} else {
|
||||
if (*ptr == '=') {
|
||||
*endkey = '\0';
|
||||
if (lastendvalue == NULL) {
|
||||
event_error("missing key or value in I: field");
|
||||
} else {
|
||||
*lastendvalue = '\0';
|
||||
event_info_key(key, value);
|
||||
};
|
||||
key = lastnewword;
|
||||
endkey = endvalue;
|
||||
doval = 1;
|
||||
ptr = ptr + 1;
|
||||
skipspace(&ptr);
|
||||
value = ptr;
|
||||
endvalue = NULL;
|
||||
lastendvalue = NULL;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
p = s;
|
||||
skipspace(&p);
|
||||
readstr (package, &p, 40);
|
||||
event_specific (package, p, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
67
store.c
Normal file → Executable file
67
store.c
Normal file → Executable file
@@ -186,7 +186,7 @@ int main()
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION "4.91 March 02 2024 abc2midi"
|
||||
#define VERSION "4.92 April 30 2024 abc2midi"
|
||||
|
||||
/* enables reading V: indication in header */
|
||||
#define XTEN1 1
|
||||
@@ -1936,6 +1936,11 @@ char *s;
|
||||
skipspace(&p);
|
||||
readstr(command, &p, 40);
|
||||
|
||||
if (s[0] == '=') {
|
||||
event_warning("Do not use MIDI= in I: command. Just use MIDI");
|
||||
done = 0;
|
||||
} /*[SS] 2024.04.30 */
|
||||
|
||||
if (strcmp(command, "channel") == 0) {
|
||||
skipspace(&p);
|
||||
ch = readnump(&p) - 1;
|
||||
@@ -2362,10 +2367,9 @@ char *s;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void event_specific(package, s)
|
||||
/* package-specific command found i.e. %%NAME */
|
||||
char *package, *s;
|
||||
/* [JA] 2024.04.30 introducing in_I */
|
||||
void event_specific(char *package, char *s, int in_I)
|
||||
{
|
||||
char msg[200], command[40];
|
||||
char *p;
|
||||
@@ -2386,7 +2390,6 @@ char *package, *s;
|
||||
process_midix(s);
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(package, "MIDI") == 0)
|
||||
event_midi(s); else {
|
||||
|
||||
@@ -2507,7 +2510,6 @@ char *package, *s;
|
||||
}
|
||||
#endif
|
||||
|
||||
event_comment(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3148,38 +3150,7 @@ int local;
|
||||
};
|
||||
}
|
||||
|
||||
void event_info_key(key, value)
|
||||
char* key;
|
||||
char* value;
|
||||
{
|
||||
int num;
|
||||
char midicmd[64];
|
||||
char errmsg[80];
|
||||
|
||||
if (strcmp(key, "octave")==0) {
|
||||
num = readsnumf(value);
|
||||
event_octave(num,0);
|
||||
};
|
||||
/* [SS] 2015-06-02 */
|
||||
if (strcmp(key, "MIDI") == 0 || strcmp(key, "MIDIx") == 0 )
|
||||
event_specific(key, value);
|
||||
|
||||
else if(strcmp(key, "volinc") == 0 || strcmp(key,"vol") == 0)
|
||||
{
|
||||
midicmd[0] = 0;
|
||||
strcat(midicmd, key);
|
||||
strcat(midicmd, " ");
|
||||
strcat(midicmd, value);
|
||||
event_specific("MIDI",midicmd);
|
||||
}
|
||||
else if (is_abcm2ps_option (key)) return;
|
||||
|
||||
else {
|
||||
/* [KG] 2022-01-13 stack overflow */
|
||||
snprintf(errmsg, 80, "I: key \' %s\' not recognized", key);
|
||||
if (quiet == -1 && silent == 0) event_error(errmsg); /* [SS] 2018-04-01 */
|
||||
}
|
||||
}
|
||||
/* deleted event_info_key(key,value) [JA] 2024-04-30 */
|
||||
|
||||
static void stack_broken(v)
|
||||
/* store away broken rhythm context on encountering grace notes */
|
||||
@@ -4618,42 +4589,42 @@ char* s;
|
||||
/* add nofnop ... */
|
||||
if (nofnop == 0) {
|
||||
if (strcmp(p, "ppp") == 0) {
|
||||
event_specific("MIDI", "beat 30 20 10 1");
|
||||
event_specific("MIDI", "beat 30 20 10 1", 0); /* [JA] 2024-04-30 and etc */
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "pp") == 0) {
|
||||
event_specific("MIDI", "beat 45 35 20 1");
|
||||
event_specific("MIDI", "beat 45 35 20 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "p") == 0) {
|
||||
event_specific("MIDI", "beat 60 50 35 1");
|
||||
event_specific("MIDI", "beat 60 50 35 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "mp") == 0) {
|
||||
event_specific("MIDI", "beat 75 65 50 1");
|
||||
event_specific("MIDI", "beat 75 65 50 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "mf") == 0) {
|
||||
event_specific("MIDI", "beat 90 80 65 1");
|
||||
event_specific("MIDI", "beat 90 80 65 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "f") == 0) {
|
||||
event_specific("MIDI", "beat 105 95 80 1");
|
||||
event_specific("MIDI", "beat 105 95 80 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "ff") == 0) {
|
||||
event_specific("MIDI", "beat 120 110 95 1");
|
||||
event_specific("MIDI", "beat 120 110 95 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
if (strcmp(p, "fff") == 0) {
|
||||
event_specific("MIDI", "beat 127 125 110 1");
|
||||
event_specific("MIDI", "beat 127 125 110 1", 0);
|
||||
done = 1;
|
||||
};
|
||||
|
||||
if ((strcmp(p,"crescendo(") == 0) || (strcmp(p,"<(") == 0) ||
|
||||
(strcmp(p,"crescendo)") == 0) || (strcmp(p,"<)") == 0)) {
|
||||
sprintf(midimsg,"beatmod %d",velocitychange);
|
||||
event_specific("MIDI", midimsg);
|
||||
event_specific("MIDI", midimsg, 0); /* [JA] 2024-04-30 */
|
||||
done = 1;
|
||||
}
|
||||
|
||||
@@ -4661,7 +4632,7 @@ if (nofnop == 0) {
|
||||
(strcmp(p,"diminuendo)") == 0) || (strcmp(p,">)") == 0) ||
|
||||
(strcmp(p,"diminuendo(") == 0) || (strcmp(p,">(") == 0)) {
|
||||
sprintf(midimsg,"beatmod -%d",velocitychange);
|
||||
event_specific("MIDI", midimsg);
|
||||
event_specific("MIDI", midimsg, 0);
|
||||
done = 1;
|
||||
}
|
||||
|
||||
|
||||
13
toabc.c
Normal file → Executable file
13
toabc.c
Normal file → Executable file
@@ -21,7 +21,7 @@
|
||||
|
||||
/* back-end for outputting (possibly modified) abc */
|
||||
|
||||
#define VERSION "2.21 Feb 19 2024 abc2abc"
|
||||
#define VERSION "2.22 April 30 2024 abc2abc"
|
||||
|
||||
/* for Microsoft Visual C++ 6.0 or higher */
|
||||
#ifdef _MSC_VER
|
||||
@@ -908,13 +908,18 @@ char *s;
|
||||
inmusic = 0;
|
||||
}
|
||||
|
||||
void event_specific(package, s)
|
||||
char *package, *s;
|
||||
/* [JA] 2024-04-30 */
|
||||
void event_specific(char *package, char *s, int in_I)
|
||||
{
|
||||
char command[40];
|
||||
int ch;
|
||||
char *p;
|
||||
emit_string("%%");
|
||||
|
||||
if (in_I) { /* [JA] 2024-04-30 */
|
||||
emit_string("I:");
|
||||
} else {
|
||||
emit_string("%%");
|
||||
}
|
||||
emit_string(package);
|
||||
emit_string(s);
|
||||
inmusic = 0;
|
||||
|
||||
7
yapstree.c
Normal file → Executable file
7
yapstree.c
Normal file → Executable file
@@ -22,7 +22,7 @@
|
||||
/* yapstree.c - back-end for abc parser. */
|
||||
/* generates a data structure suitable for typeset music */
|
||||
|
||||
#define VERSION "1.93 February 19 2024 yaps"
|
||||
#define VERSION "1.94 April 30 2024 yaps"
|
||||
#include <stdio.h>
|
||||
#ifdef USE_INDEX
|
||||
#define strchr index
|
||||
@@ -1525,9 +1525,8 @@ int make_open()
|
||||
return(1);
|
||||
}
|
||||
|
||||
void event_specific(p, str)
|
||||
char *p; /* first word after %% */
|
||||
char *str; /* string following first word */
|
||||
/* [JA] 2024-04-30 introducing in_I */
|
||||
void event_specific(char *p, char *str, int in_I)
|
||||
/* The special comment %% has been found */
|
||||
/* abc2midi uses it for the %%MIDI commands */
|
||||
/* yaps implements some of the abc2ps commands */
|
||||
|
||||
Reference in New Issue
Block a user