mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-08 19:01:02 +00:00
Compare commits
3 Commits
2022.02.21
...
2022.04.06
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85e4e1ba50 | ||
|
|
47a0cecc5d | ||
|
|
35876618bb |
42
doc/CHANGES
42
doc/CHANGES
@@ -14661,4 +14661,46 @@ if (strstr(line,"%%begintext") != NULL) {
|
||||
which returns the pointer to %%begintext in the line.
|
||||
|
||||
|
||||
March 20 2022
|
||||
|
||||
abc2midi bug: I could not demonstrate this bug on my own system.
|
||||
|
||||
When abc2midi is compiled on a Debian linux system using the -O2 compilation
|
||||
flag (by default), it produces a faulty midi file for abc files containing
|
||||
gchords. Here is a sample file.
|
||||
|
||||
%abc-2.2
|
||||
X:1
|
||||
T:Test
|
||||
M:C
|
||||
L:1/4
|
||||
Q:1/4=135
|
||||
V:S clef=treble
|
||||
V:s clef=treble
|
||||
K:C
|
||||
%%score (s S)
|
||||
%
|
||||
[V:s] "C" x2 "a" x2 |
|
||||
[V:S] C C A A |
|
||||
|
||||
The problem occurs with the bass accompaniment generated by "a". The
|
||||
bass accompaniment creates a long string of A,, notes.
|
||||
|
||||
This problem disappears when abc2midi is compiled without the
|
||||
-O2 optimizer.
|
||||
|
||||
Analysis: the bug was traced to the code gchord_configure in genmidi.c.
|
||||
The limit of the loops
|
||||
for (j=0; j<chordlen[chordnum]; j++)
|
||||
contain bad data when chordnum is set to -1 (for bass accompaniment).
|
||||
|
||||
Fix: exit from gchord_configure function when chordnum is less than
|
||||
zero.
|
||||
|
||||
The problem was identified to me by Jakob Englhauser. Jakob verified
|
||||
that this fix works.
|
||||
|
||||
|
||||
April 06 midi2abc: removal of spaces in text strings for control
|
||||
messages.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
abcMIDI : abc <-> MIDI conversion utilities
|
||||
|
||||
midi2abc version 3.50 February 12 2022
|
||||
abc2midi version 4.69 February 22 2022
|
||||
midi2abc version 3.53 April 06 2022
|
||||
abc2midi version 4.70 March 20 2022
|
||||
abc2abc version 2.16 February 22 2022
|
||||
yaps version 1.88 February 22 2022
|
||||
abcmatch version 1.80 November 25 2021
|
||||
|
||||
@@ -358,7 +358,9 @@ void configure_gchord()
|
||||
{
|
||||
int j;
|
||||
int inchord, note;
|
||||
|
||||
gchordnotes_size = 0;
|
||||
if (chordnum < 0) return; /* [SS] 2022-03-20 */
|
||||
|
||||
inchord = 0;
|
||||
if (inversion != -1) {
|
||||
|
||||
43
midi2abc.c
43
midi2abc.c
@@ -45,7 +45,7 @@
|
||||
* based on public domain 'midifilelib' package.
|
||||
*/
|
||||
|
||||
#define VERSION "3.49 June 27 2021 midi2abc"
|
||||
#define VERSION "3.53 April 06 2022 midi2abc"
|
||||
|
||||
#include <limits.h>
|
||||
/* Microsoft Visual C++ Version 6.0 or higher */
|
||||
@@ -165,6 +165,7 @@ int header_keysig= -50; /* header key signature */
|
||||
int active_keysig = -50; /* last key signature declared */
|
||||
int xchannel; /* channel number to be extracted. -1 means all */
|
||||
int timeunits = 1; /*tells prtime to display time in beats [SS] 2018-10-25 */
|
||||
double bend2cents = 40.96; /* [SS] 2022-02-12 */
|
||||
|
||||
|
||||
/* structure for storing music notes */
|
||||
@@ -809,7 +810,7 @@ char *mess;
|
||||
int n;
|
||||
char *p = mess;
|
||||
char *buff;
|
||||
char buffer2[BUFFSIZE];
|
||||
char buffer2[BUFFSIZE+4]; /* [SS] 2022-02-12 */
|
||||
|
||||
if ((type < 1)||(type > unrecognized))
|
||||
type = unrecognized;
|
||||
@@ -1148,6 +1149,8 @@ void stats_header (int format, int ntrks, int ldivision)
|
||||
for (i=0;i<17;i++) {
|
||||
trkdata.npulses[i] = 0;
|
||||
trkdata.pitchbend[i] = 0;
|
||||
trkdata.cntlparam[i] = 0; /* [SS] 2022-03-04 */
|
||||
trkdata.pressure[i] = 0; /* [SS] 2022-03-04 */
|
||||
progcolor[i] = 0;
|
||||
channel2prog[i] = -1;
|
||||
channel2nnotes[i] = 0;
|
||||
@@ -1308,6 +1311,7 @@ for (i=0;i<17;i++) {
|
||||
printf("%d %d ",i,trkdata.program[i]); /* channel number and program*/
|
||||
printf("%d %d ",trkdata.notecount[i],trkdata.chordcount[i]);
|
||||
printf("%d %d ",trkdata.notemeanpitch[i], trkdata.notelength[i]);
|
||||
printf("%d %d ",trkdata.cntlparam[i],trkdata.pressure[i]); /* [SS] 2022-03-04 */
|
||||
printf("\n");
|
||||
|
||||
channel2nnotes[i] += trkdata.notecount[i] + trkdata.chordcount[i];
|
||||
@@ -1408,13 +1412,21 @@ void stats_noteoff(int chan,int pitch,int vol)
|
||||
if(Mf_currtime > last_tick[chan+1]) last_tick[chan+1] = Mf_currtime;
|
||||
}
|
||||
|
||||
void mftxt_pressure(chan,pitch,press)
|
||||
void mftxt_polypressure(chan,pitch,press)
|
||||
int chan, pitch, press;
|
||||
{
|
||||
char *key;
|
||||
if (prtime(timeunits)) return;
|
||||
key = pitch2key(pitch);
|
||||
printf("Pressure %2d %3s %3d\n",chan+1,key,press);
|
||||
printf("Polyphonic Key Pressure %2d %3s %3d\n",chan+1,key,press);
|
||||
}
|
||||
void mftxt_chanpressure(chan,pitch,press)
|
||||
int chan, pitch, press;
|
||||
{
|
||||
char *key;
|
||||
if (prtime(timeunits)) return;
|
||||
key = pitch2key(pitch);
|
||||
printf("Channel Pressure %2d %3s %3d\n",chan+1,key,press);
|
||||
}
|
||||
|
||||
|
||||
@@ -1423,6 +1435,7 @@ int chan, lsb, msb;
|
||||
{
|
||||
float bend;
|
||||
int pitchbend;
|
||||
double cents;
|
||||
/*
|
||||
if (onlychan >=0 && chan != onlychan) return;
|
||||
*/
|
||||
@@ -1430,8 +1443,8 @@ int chan, lsb, msb;
|
||||
/* [SS] 2014-01-05 2015-08-04*/
|
||||
pitchbend = (msb*128 + lsb);
|
||||
bend = (float) (pitchbend - 8192);
|
||||
bend = bend/40.96;
|
||||
printf("Pitchbend %2d %d bend = %6.3f (cents)\n",chan+1,pitchbend,bend);
|
||||
cents = bend/bend2cents; /* [SS] 2022-02-12 */
|
||||
printf("Pitchbend %2d %d cents = %6.3f (cents)\n",chan+1,pitchbend,cents);
|
||||
}
|
||||
|
||||
void stats_pitchbend(chan,lsb,msb)
|
||||
@@ -1517,13 +1530,14 @@ if (trkdata.program[chan+1] != 0) {
|
||||
void mftxt_parameter(chan,control,value)
|
||||
int chan, control, value;
|
||||
{
|
||||
/* removal of spaces [SS] 2022-04-06 in ctype array */
|
||||
static char *ctype[] = {
|
||||
"BankSelect", "ModulationWheel", /*1*/
|
||||
"Breath controller", "unknown", /*3*/
|
||||
"BreathController", "unknown", /*3*/
|
||||
"FootPedal", "PortamentoTime", /*5*/
|
||||
"DataEntry", "Volume", /*7*/
|
||||
"Balance", "unknown", /*9*/
|
||||
"Pan position", "Expression", /*11*/
|
||||
"PanPosition", "Expression", /*11*/
|
||||
"EffectControl1", "EffectControl2", /*13*/
|
||||
"unknown", "unknown", /*15*/
|
||||
"Slider1", "Slider2", /*17*/
|
||||
@@ -1535,11 +1549,11 @@ int chan, control, value;
|
||||
"unknown", "unknown", /*29*/
|
||||
"unknown", "unknown", /*31*/
|
||||
"BankSelect(fine)", "ModulationWheel(fine)", /*33*/
|
||||
"Breath controller (fine)", "unknown", /*35*/
|
||||
"BreathController(fine)", "unknown", /*35*/
|
||||
"FootPedal(fine)", "PortamentoTime(fine)", /*37*/
|
||||
"DataEntry(fine)", "Volume(fine)", /*39*/
|
||||
"Balance(fine)", "unknown", /*41*/
|
||||
"Pan position (fine)", "Expression (fine)", /*43*/
|
||||
"PanPosition(fine)", "Expression(fine)", /*43*/
|
||||
"EffectControl1(fine)", "EffectControl2(fine)", /*45*/
|
||||
"unknown", "unknown", /*47*/
|
||||
"unknown", "unknown", /*49*/
|
||||
@@ -1566,9 +1580,9 @@ int chan, control, value;
|
||||
"unknown", "EffectsLevel", /*91*/
|
||||
"TremoloLevel", "ChorusLevel", /*93*/
|
||||
"CelesteLevel", "PhaserLevel", /*95*/
|
||||
"Data button increment", "Data button decrement", /*97*/
|
||||
"DataButtonIncrement", "DataButtonDecrement", /*97*/
|
||||
"NRP(fine)", "NRP(coarse)", /*99*/
|
||||
"Registered parameter (fine)", "Registered parameter (coarse)", /*101*/
|
||||
"RegisteredParameter(fine)", "RegisteredParameter(coarse)", /*101*/
|
||||
"unknown", "unknown", /*103*/
|
||||
"unknown", "unknown", /*105*/
|
||||
"unknown", "unknown", /*107*/
|
||||
@@ -1586,6 +1600,7 @@ int chan, control, value;
|
||||
/* if (onlychan >=0 && chan != onlychan) return; */
|
||||
if (prtime(timeunits)) return;
|
||||
|
||||
if (control == 6) bend2cents = 8192.0/(100.0*value); /*[SS] 2022-02-12 */
|
||||
printf("CntlParm %2d %s = %d\n",chan+1, ctype[control],value);
|
||||
}
|
||||
|
||||
@@ -1776,11 +1791,11 @@ void initfunc_for_mftext()
|
||||
Mf_trackend = txt_trackend;
|
||||
Mf_noteon = mftxt_noteon;
|
||||
Mf_noteoff = mftxt_noteoff;
|
||||
Mf_pressure =mftxt_pressure;
|
||||
Mf_pressure =mftxt_polypressure;
|
||||
Mf_parameter = mftxt_parameter;
|
||||
Mf_pitchbend = mftxt_pitchbend;
|
||||
Mf_program = mftxt_program;
|
||||
Mf_chanpressure = mftxt_pressure;
|
||||
Mf_chanpressure = mftxt_chanpressure;
|
||||
Mf_sysex = no_op2;
|
||||
Mf_metamisc = no_op3;
|
||||
Mf_seqnum = no_op1;
|
||||
|
||||
4
store.c
4
store.c
@@ -186,7 +186,7 @@ int main()
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION "4.70 February 22 2022 abc2midi"
|
||||
#define VERSION "4.71 March 20 2022 abc2midi"
|
||||
|
||||
/* enables reading V: indication in header */
|
||||
#define XTEN1 1
|
||||
@@ -1860,7 +1860,7 @@ nmidicmd++;
|
||||
/* [SS] 2015-06-01 For converting the %%MIDIx command to a
|
||||
%%MIDI command
|
||||
*/
|
||||
void event_midi();
|
||||
void event_midi(char* s); /* [SS] 2022-03-19 */
|
||||
|
||||
|
||||
void process_midix(s)
|
||||
|
||||
Reference in New Issue
Block a user