mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-08 10:41:02 +00:00
Compare commits
7 Commits
2021.12.12
...
2022.02.21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eaf451d6ad | ||
|
|
cded63b590 | ||
|
|
57a5ae2ba7 | ||
|
|
6c7ff05c49 | ||
|
|
e58956238a | ||
|
|
0b83ee2c7b | ||
|
|
fb5479e801 |
@@ -13,7 +13,7 @@ Seymour added two more programs:
|
||||
1. abcmatch for finding common elements in a collection of abc tunes and,
|
||||
2. midicopy for copying parts of a midi file to a new midi file.
|
||||
|
||||
Yaps has been superceded by [Jef Moine](http://moinejf.free.fr/) abcm2ps and abc2svg programs. Midi2abc has been expanded to include mftext and various other features for supporting the [runabc](https://ifdo.ca/~seymour/runabc/top.html) application. Abc2midi has numerous new features that are described in its own web page [abc2midi guide](https://ifdo.ca/~seymour/runabc/abcguide/abc2midi_guide.html).
|
||||
Yaps has been superceded by [Jef Moine](http://moinejf.free.fr/) abcm2ps and abc2svg programs. Midi2abc has been expanded to include mftext and various other features for supporting the [runabc](https://ifdo.ca/~seymour/runabc/top.html) application. Abc2midi has numerous new features that are described in its own web page [abc2midi guide](https://abcmidi.sourceforge.io).
|
||||
|
||||
Components of the abcMIDI package are parts of numerous applications for creating and editing abc files. Compilations of these components for various operating systems can be found on [The ABC Plus Project](http://abcplus.sourceforge.net/) web page.
|
||||
|
||||
|
||||
125
doc/CHANGES
125
doc/CHANGES
@@ -14537,3 +14537,128 @@ December 12 2021
|
||||
abcmidi: changed bar length warning as suggested by James Allwright.
|
||||
|
||||
|
||||
January 13 2022
|
||||
|
||||
abc2midi: stack overflow bugs reported by Kolja Grassmann
|
||||
<koljagrassman@mailbox.org>
|
||||
|
||||
static int getword(place,w) in genmidi.c
|
||||
check that the syllable[200] array is not overrun
|
||||
in the while loop ((syllastus != postword)...) add && (i<199)
|
||||
|
||||
static void karaokestarttrack in genmidi.c
|
||||
replace strcpy(atitle+2,atext[pitch[j]])
|
||||
with strncpy(atitle+2,atext[pitch[j]], 197)
|
||||
to prevent overflowing the atitle[200] array
|
||||
in three places.
|
||||
|
||||
static int inlist(place, passno) in genmidi.c
|
||||
To prevent stack overflow in msg[100];
|
||||
use snprintf instead of sprintf
|
||||
snprintf(msg, 100, "Bad variant list : %s", atext[pitch[place]]);
|
||||
|
||||
void event_handle_instruction(s) in store.c
|
||||
To prevent overrunning the array buff[MAXLINE]
|
||||
used snprintf instead of sprintf
|
||||
snprintf(buff, MAXLINE, "instruction !%s! ignored", s);
|
||||
|
||||
void event_info_key(key, value) in store.c
|
||||
To prevent overrunning the array errmsg[80]
|
||||
used snprintf instead of sprintf
|
||||
snprintf(errmsg, 80, "I: key \' %s\' not recognized", key);
|
||||
|
||||
|
||||
January 27 2022
|
||||
|
||||
abcmidi: new feature
|
||||
%%MIDI pitchbendrange semi
|
||||
maps the pitchwheel 0 to 16383 to semi semitones. By default semi
|
||||
is set to 2. If you change it to 4, then the pitchwheel maps into
|
||||
+/-4 semitones. This effects all microtones in the active channel
|
||||
when semi is not 2. %%MIDI temperament commands may not work
|
||||
correctly. Here is an example.
|
||||
|
||||
X:1
|
||||
T: pitch bend with RPN
|
||||
M: 4/4
|
||||
L: 1/4
|
||||
K: G
|
||||
%%MIDI program 70
|
||||
G2 B2 |\
|
||||
%%MIDI bendstring 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500
|
||||
!bend! G4 |\
|
||||
%%MIDI pitchbendrange 7
|
||||
!bend! G4 |
|
||||
|
||||
February 12 2022
|
||||
Midi2abc -mftext: adjusted the pitchbend sensitivity bend2cents when
|
||||
a RPN control command is received (in function mftxt_parameter).
|
||||
|
||||
February 13 2022
|
||||
abc2midi: added an optional third parameter to %%MIDI bendvelocity
|
||||
which specifies the number of MIDI pitchbend messages to create.
|
||||
If this parameter is missing, the default is 8 as before.
|
||||
|
||||
|
||||
February 18 2022
|
||||
abc2midi bug: the K: and V: score option transposes the music in the
|
||||
wrong direction. eg
|
||||
|
||||
X:1
|
||||
T: transpose
|
||||
M: 4/4
|
||||
L: 1/4
|
||||
K: G sound = DC
|
||||
CDEF|GABc|
|
||||
|
||||
CDEF... converted to BbCDE.. instead of DEF#G...
|
||||
|
||||
Fix: swapped p2 and p1 in
|
||||
*transpose = p2 - p1;
|
||||
in parsesound() in parseabc.c
|
||||
|
||||
February 21 2022
|
||||
abc2abc mangles text. eg
|
||||
input:
|
||||
|
||||
X:1
|
||||
T: Text mangled by abc2abc
|
||||
Q:1/2=120
|
||||
M:4/4
|
||||
L:1/8
|
||||
K:G bass octave=-2
|
||||
%%begintext center
|
||||
this text is mangled
|
||||
%%endtext
|
||||
%%
|
||||
!f! g2 z d g2 z d | gdgb d'2 z2 | c'2 z a c'2 z a | cafa d2 z2 | gggg gggg | [I:repeat] |
|
||||
|
||||
abc2abc text.abc -t 2 >output.abc
|
||||
|
||||
output:
|
||||
|
||||
X:1
|
||||
T:Text mangled by abc2abc
|
||||
Q:1/2=120
|
||||
M:4/4
|
||||
L:1/8
|
||||
K:Amaj clef=bass octave=-2
|
||||
%%begintext center
|
||||
this tfxt is mbnalfe
|
||||
%%endtext
|
||||
%%
|
||||
!f! a2 z e a2 z e | aeac' e'2 z2 | d'2 z b d'2 z b | dbgb e2 z2 | aaaa aaaa | [I:repeat] |
|
||||
|
||||
Analysis:
|
||||
Parseline (line) in parseabc.c checks the line for %%begintext using strcmp.
|
||||
Unfortunately, it does not find a match because the line also contains
|
||||
the word 'center'.
|
||||
|
||||
Fix: replaced
|
||||
if (strcmp(line,"%%begintext") == 0) {
|
||||
with
|
||||
if (strstr(line,"%%begintext") != NULL) {
|
||||
which returns the pointer to %%begintext in the line.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
abcMIDI : abc <-> MIDI conversion utilities
|
||||
|
||||
midi2abc version 3.48 June 27 2021
|
||||
abc2midi version 4.64 December 12 2021
|
||||
abc2abc version 2.15 May 25 2021
|
||||
yaps version 1.87 May 25 2021
|
||||
midi2abc version 3.50 February 12 2022
|
||||
abc2midi version 4.69 February 22 2022
|
||||
abc2abc version 2.16 February 22 2022
|
||||
yaps version 1.88 February 22 2022
|
||||
abcmatch version 1.80 November 25 2021
|
||||
midicopy version 1.37 October 10 2020
|
||||
|
||||
|
||||
57
genmidi.c
57
genmidi.c
@@ -31,8 +31,11 @@
|
||||
/* for Microsoft Visual C++ Ver 6 and higher */
|
||||
#ifdef _MSC_VER
|
||||
#define ANSILIBS
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
|
||||
#include "abc.h"
|
||||
#include "parseabc.h"
|
||||
#include "queues.h"
|
||||
@@ -811,17 +814,17 @@ int track;
|
||||
if (feature[j] == TITLE) {
|
||||
if (track != 2)
|
||||
mf_write_meta_event(0L, sequence_name, atext[pitch[j]], strlen (atext[pitch[j]]));
|
||||
strcpy(atitle+2, atext[pitch[j]]);
|
||||
strncpy(atitle+2, atext[pitch[j]], 197); /* [KG] 2022-01-13 stack overflow bug */
|
||||
text_data(atitle);
|
||||
done--;
|
||||
}
|
||||
if (feature[j] == COMPOSER) {
|
||||
strcpy(atitle+2, atext[pitch[j]]);
|
||||
strncpy(atitle+2, atext[pitch[j]], 197); /* [KG] 2022-01-13 stack overflow bug */
|
||||
text_data(atitle);
|
||||
done--;
|
||||
}
|
||||
if (feature[j] == COPYRIGHT) {
|
||||
strcpy(atitle+2, atext[pitch[j]]);
|
||||
strcpy(atitle+2, atext[pitch[j]]); /* [KG] 2022-01-13 stack overflow bug */
|
||||
text_data(atitle);
|
||||
done--;
|
||||
}
|
||||
@@ -966,7 +969,8 @@ int w;
|
||||
syllstatus = empty;
|
||||
c = *(words[w]+(*place));
|
||||
isBig5 = 0; /* [BI] 2012-10-03 */
|
||||
while ((syllstatus != postword) && (syllstatus != failed)) {
|
||||
while ((syllstatus != postword) && (syllstatus != failed) && (i<199)) {
|
||||
/* [KG] 2022-01-13 stack overflow bug fix */
|
||||
syllable[i] = c;
|
||||
/* printf("syllstatus = %d c = %c i = %d place = %d row= %d \n",syllstatus,c,i,*place,w); */
|
||||
if (isBig5) { /* [BI] 2012-10-03 */
|
||||
@@ -1252,7 +1256,8 @@ int passno;
|
||||
found = 0;
|
||||
while ((found == 0) && (*p != '\0')) {
|
||||
if (!isdigit(*p)) {
|
||||
sprintf(msg, "Bad variant list : %s", atext[pitch[place]]);
|
||||
snprintf(msg, 100, "Bad variant list : %s", atext[pitch[place]]);
|
||||
/* [KG] 2022-01-13 stack overflow bug */
|
||||
event_error(msg);
|
||||
found = 1;
|
||||
};
|
||||
@@ -1415,8 +1420,6 @@ static void midi_re_tune (int channel) {
|
||||
this is done.
|
||||
*/
|
||||
char data[2];
|
||||
data[0] = (char) (bend & 0x7f); /* least significant bits */
|
||||
data[1] = (char) ((bend >>7) & 0x7f);
|
||||
/* indicate that we are applying RPN fine and gross tuning using
|
||||
the following two control commands.
|
||||
control 101 0
|
||||
@@ -1439,6 +1442,29 @@ data[1] = (char) (bend & 0x7f); /* least significant bits */
|
||||
write_event(control_change, channel, data, 2);
|
||||
}
|
||||
|
||||
/* [SS] 2022-01-27 */
|
||||
static void midiPitchBendRange (int semis) {
|
||||
/* by default the pitch wheel maps 0 to 16383 to a range of 4
|
||||
* semitones. This function uses the RPN control command to
|
||||
* expand the range to semis semitones.
|
||||
*/
|
||||
char data[2];
|
||||
/* indicate that we are applying RPN fine and gross tuning using
|
||||
the following two control commands.
|
||||
control 101 0
|
||||
control 100 0 */
|
||||
data[0] = 101; /* RPN command */
|
||||
data[1] = 0; /* type of command */
|
||||
write_event(control_change, channel, data, 2);
|
||||
data[0] = 6; /* contains most significant byte */
|
||||
data[1] = semis;
|
||||
write_event(control_change, channel, data, 2);
|
||||
data[0] = 38; /* contains least significant byte (range in cents) */
|
||||
data[1] = 0;
|
||||
write_event(control_change, channel, data, 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* [SS] 2011-07-04 */
|
||||
@@ -2048,14 +2074,17 @@ int noteson;
|
||||
skipspace(&p);
|
||||
val = readsnump(&p);
|
||||
bendacceleration = val;
|
||||
skipspace(&p); /* [SS] 2022-02-13 */
|
||||
val = readsnump(&p);
|
||||
if (val > 0 && val < 100) bendnvals = val;
|
||||
else bendnvals = 8;
|
||||
|
||||
/* [SS] 2015-08-11 */
|
||||
bendnvals = 0;
|
||||
if (bendvelocity != 0 || bendacceleration != 0) {
|
||||
for (i = 0; i<8; i++) {
|
||||
for (i = 0; i<bendnvals; i++) { /* [SS] 2022-02-13 */
|
||||
benddata[i] = bendvelocity;
|
||||
bendvelocity = bendvelocity + bendacceleration;
|
||||
}
|
||||
bendnvals = 8;
|
||||
}
|
||||
/*bendtype = 1; [SS] 2015-08-11 */
|
||||
if (bendnvals == 1) bendtype = 3; /* [SS] 2014-09-22 */
|
||||
@@ -2095,6 +2124,14 @@ int noteson;
|
||||
else bendtype = 2;
|
||||
}
|
||||
|
||||
/* [SS] 2022-01-27 */
|
||||
else if (strcmp(command, "pitchbendrange") == 0) {
|
||||
int semis;
|
||||
semis = readsnump(&p);
|
||||
midiPitchBendRange(semis);
|
||||
done = 1;
|
||||
}
|
||||
|
||||
|
||||
else if (strcmp(command, "drone") == 0) {
|
||||
skipspace(&p);
|
||||
|
||||
@@ -1056,7 +1056,7 @@ parsesound (s, word, gottranspose, transpose)
|
||||
*transpose = 0;
|
||||
} else {
|
||||
/* printf("midi note = %d\n",p2); */
|
||||
*transpose = p2 - p1;
|
||||
*transpose = p1 - p2; /* [SS] 2022.02.18 */
|
||||
/* printf("transpose = %d\n",*transpose); */
|
||||
*gottranspose = 1;
|
||||
}
|
||||
@@ -3353,11 +3353,11 @@ parseline (line)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
/* [SS] 2020-01-03 */
|
||||
if (strcmp(line,"%%begintext") == 0) {
|
||||
/* [SS] 2020-01-03 2021-02-21 */
|
||||
if (strstr(line,"%%begintext") != NULL) {
|
||||
ignore_line = 1;
|
||||
}
|
||||
if (strcmp(line,"%%endtext") == 0) {
|
||||
if (strstr(line,"%%endtext") != NULL) {
|
||||
ignore_line = 0;
|
||||
}
|
||||
/* [SS] 2021-05-09 */
|
||||
|
||||
8
store.c
8
store.c
@@ -186,7 +186,7 @@ int main()
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION "4.64 December 12 2021 abc2midi"
|
||||
#define VERSION "4.70 February 22 2022 abc2midi"
|
||||
|
||||
/* enables reading V: indication in header */
|
||||
#define XTEN1 1
|
||||
@@ -3171,7 +3171,8 @@ char* value;
|
||||
else if (is_abcm2ps_option (key)) return;
|
||||
|
||||
else {
|
||||
sprintf(errmsg,"I: key \' %s\' not recognized", key);
|
||||
/* [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 */
|
||||
}
|
||||
}
|
||||
@@ -4747,7 +4748,8 @@ if (nofnop == 0) {
|
||||
};
|
||||
|
||||
if (done == 0 && quiet == -1) { /* [SS] 2013-11-02 */
|
||||
sprintf(buff, "instruction !%s! ignored", s);
|
||||
snprintf(buff, MAXLINE, "instruction !%s! ignored", s);
|
||||
/* [KG] 2022-01-13 static overflow */
|
||||
event_warning(buff);
|
||||
};
|
||||
}
|
||||
|
||||
2
toabc.c
2
toabc.c
@@ -21,7 +21,7 @@
|
||||
|
||||
/* back-end for outputting (possibly modified) abc */
|
||||
|
||||
#define VERSION "2.15 May 25 2021 abc2abc"
|
||||
#define VERSION "2.16 February 21 2022 abc2abc"
|
||||
|
||||
/* for Microsoft Visual C++ 6.0 or higher */
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/* yapstree.c - back-end for abc parser. */
|
||||
/* generates a data structure suitable for typeset music */
|
||||
|
||||
#define VERSION "1.87 May 25 2021 yaps"
|
||||
#define VERSION "1.88 February 22 2022 yaps"
|
||||
#include <stdio.h>
|
||||
#ifdef USE_INDEX
|
||||
#define strchr index
|
||||
|
||||
Reference in New Issue
Block a user