mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-06 06:55:06 +00:00
Compare commits
4 Commits
2025.02.07
...
2025.06.17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1089104c37 | ||
|
|
ab7f0622c2 | ||
|
|
d486659fdd | ||
|
|
907c8fa19f |
54
doc/CHANGES
54
doc/CHANGES
@@ -15614,3 +15614,57 @@ for
|
||||
(clef->octave_offset and v->octaveshift are both -1. We want to apply
|
||||
only one of those.)
|
||||
|
||||
|
||||
February 15 2025
|
||||
|
||||
abc2midi ignores accidentals when converting to a temperamentequal scale.
|
||||
In the following example:
|
||||
|
||||
X:1
|
||||
T: temperamentequal 19
|
||||
M: 4/4
|
||||
L: 1/4
|
||||
%%MIDI temperamentequal 19
|
||||
K: none
|
||||
C ^C _D D | ^D _E E F | ^F _G G ^G| _A A ^A _B| B c z z|
|
||||
|
||||
the accidentals were ignored when creating the midi file.
|
||||
|
||||
Fix:
|
||||
|
||||
Changed
|
||||
/* respect accidentals when they do not occur in a microtone */
|
||||
if (acc == '^' && !microtone) pitchvalue = pitchvalue + (float) mul; /* [SS] 2025-01-12 */
|
||||
if (acc == '_' && !microtone) pitchvalue = pitchvalue - (float) mul;
|
||||
|
||||
To
|
||||
|
||||
/* respect accidentals when they do not occur in a microtone */
|
||||
if (acc == '^' && !microtone) pitchvalue = pitchvalue + (float) (mul*accidental_size); /* [SS] 2025-02-15 */
|
||||
if (acc == '_' && !microtone) pitchvalue = pitchvalue - (float) (mul*accidental_size);
|
||||
|
||||
|
||||
February 16 2025
|
||||
|
||||
abc2midi produced the wrong results for temperamentequal 31
|
||||
|
||||
X:5
|
||||
T: temperamentequal 31
|
||||
M:none
|
||||
L:1/2
|
||||
K:C
|
||||
%
|
||||
%%text \%\%MIDI temperamentequal 31
|
||||
%%MIDI temperamentequal 31
|
||||
"^Octave divided in 31 equal parts"\
|
||||
=c ^/c ^c ^3/c ^^c =d _/d _d _3/d __d =c2 |
|
||||
%
|
||||
|
||||
Fix:
|
||||
In pitchof_b (store.c) it is necessary to scale the microtoneshift by the
|
||||
accidental_size prior to adding it to the pitchvalue.
|
||||
|
||||
pitchvalue += microtoneshift*accidental_size; /* [SS] 2025.02.16 */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
abcMIDI : abc <-> MIDI conversion utilities
|
||||
|
||||
midi2abc version 3.62 February 06 2025
|
||||
abc2midi version 5.00 February 12 2025
|
||||
midi2abc version 3.64 June 14 2025
|
||||
abc2midi version 5.02 February 16 2025
|
||||
abc2abc version 2.22 April 30 2024
|
||||
yaps version 1.94 April 30 2024
|
||||
abcmatch version 1.83 February 19 2024
|
||||
midicopy version 1.40 August 11 2024
|
||||
midistats version 0.98 January 30 2025
|
||||
midistats version 0.99 June 17 2025
|
||||
|
||||
24th January 2002
|
||||
Copyright James Allwright
|
||||
|
||||
42
midi2abc.c
42
midi2abc.c
@@ -45,7 +45,7 @@
|
||||
* based on public domain 'midifilelib' package.
|
||||
*/
|
||||
|
||||
#define VERSION "3.62 February 07 2025 midi2abc"
|
||||
#define VERSION "3.64 June 14 2025 midi2abc"
|
||||
|
||||
#include <limits.h>
|
||||
/* Microsoft Visual C++ Version 6.0 or higher */
|
||||
@@ -703,22 +703,23 @@ if (leng == 12) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* for (i=0;i<12;i++) printf(" %d,",mess[i]);
|
||||
printf("\n");
|
||||
*/
|
||||
midipitch = mess[7];
|
||||
newpitch = mess[8];
|
||||
low = mess[9];
|
||||
hi = mess[10];
|
||||
hi = mess[9];
|
||||
low = mess[10];
|
||||
hilo = hi*128 + low;
|
||||
ratio = (float) hilo/16384.0;
|
||||
ratio = (float) (hilo/16384.0);
|
||||
cents = (int) (0.5 + ratio*100.0);
|
||||
modifiedPitch = (float) midipitch + ratio;
|
||||
sysexBentPitches[newpitch] = modifiedPitch;
|
||||
modifiedPitch = (float) (midipitch + ratio);
|
||||
sysexBentPitches[midipitch] = modifiedPitch;
|
||||
/*sysexBentPitches[newpitch] = modifiedPitch; /* why */
|
||||
|
||||
/*printf("%d %d %d %d %f %d\n",midipitch,newpitch,low,hi,ratio,cents);
|
||||
printf("sysext: %d %d\n",newpitch,cents);
|
||||
*/
|
||||
return;
|
||||
} else {
|
||||
printf("leng was %d\n",leng);
|
||||
/*printf("%d %d %d %d %f %d\n",midipitch,newpitch,low,hi,ratio,cents);*/
|
||||
/*printf("sysext: %d %d\n",newpitch,cents);*/
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1003,27 +1004,34 @@ int start_time,initvol;
|
||||
int cents,centvalue,pitchbend;
|
||||
int newpitchint;
|
||||
float newpitch,fcents;
|
||||
int position;
|
||||
|
||||
|
||||
start_time = close_note(chan, pitch, &initvol);
|
||||
position = start_time*50/division;
|
||||
if (start_time <= 0) return;
|
||||
if (sysexBentPitches[pitch] >0.0) {
|
||||
newpitch = sysexBentPitches[pitch];
|
||||
newpitchint = (int) newpitch;
|
||||
cents = (newpitch -newpitchint)*100;
|
||||
if (cents >= 50) {newpitch = newpitch - 1.0; /* undo rounding */
|
||||
newpitchint = (int) newpitch;
|
||||
cents = (newpitch -newpitchint)*100;
|
||||
}
|
||||
centvalue = (newpitchint % 12)*100 + cents;
|
||||
printf("%f\t%d\t%d\n",sysexBentPitches[pitch],cents,centvalue);
|
||||
printf("%d\t%f\t%d\t%d\n",position,newpitch,cents,centvalue);
|
||||
}
|
||||
else
|
||||
{pitchbend = chanbend[chan+1];
|
||||
fcents = 100.0 * (float) (pitchbend - 8192)/4096.0;
|
||||
cents = (int) (fcents + 0.5);
|
||||
if (cents < 0) {
|
||||
pitch--;
|
||||
/*pitch--; already flattened without pitchbend*/
|
||||
cents +-100;
|
||||
}
|
||||
centvalue = cents + (pitch % 12)*100;
|
||||
newpitch = (float) pitch + cents/100.0;
|
||||
printf("%f\t%d (%d)\t%d\n",newpitch,cents,pitchbend,centvalue);
|
||||
printf("%d\t%f\t%d (%d)\t%d\n",position,newpitch,cents,pitchbend,centvalue);
|
||||
}
|
||||
|
||||
if(Mf_currtime > last_tick[chan+1]) last_tick[chan+1] = Mf_currtime;
|
||||
@@ -1394,13 +1402,13 @@ char *mess;
|
||||
if (prtime(timeunits)) return;
|
||||
printf("Metatext (%s) ",ttype[type]);
|
||||
len = leng;
|
||||
if (len > 15) len = 15;
|
||||
if (len > 55) len = 55; /* [SS] 2025-06-14 */
|
||||
for ( n=0; n<len; n++ ) {
|
||||
c = (*p++) & 0xff;
|
||||
if(iscntrl(c)) {printf(" \\0x%02x",c); continue;} /* no <cr> <lf> */
|
||||
printf( (isprint(c)||isspace(c)) ? "%c" : "\\0x%02x" , c);
|
||||
}
|
||||
if (leng>15) printf("...");
|
||||
if (leng>55) printf("...");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1028,7 +1028,7 @@ int number,intfraction;
|
||||
float fraction;
|
||||
eputc(0); /* varinum delta_t (time to next event) */
|
||||
eputc(0xf0); /* sysex initiation */
|
||||
eputc(11); /* 11 bytes included in sysex */
|
||||
eputc(11); /* 11 bytes included in sysex */
|
||||
eputc(127); /* universal sysex command (0x7f) */
|
||||
eputc(0); /* device id */
|
||||
eputc(8); /* midi tuning */
|
||||
@@ -1040,7 +1040,7 @@ eputc(kk); /* MIDI key 0 - 127 */
|
||||
number = (int) midipitch;
|
||||
fraction = midipitch - (float) number;
|
||||
if (fraction < 0.0) fraction = -fraction;
|
||||
intfraction = (int) fraction*16384;
|
||||
intfraction = (int) (fraction*16384); /* [HML] 2025-02-09 */
|
||||
xx = 0x7f & number;
|
||||
yy = intfraction/128;
|
||||
zz = intfraction % 128;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define VERSION "0.98 January 30 2025 midistats"
|
||||
#define VERSION "0.99 June 17 2025 midistats"
|
||||
|
||||
/* midistrats.c is a descendent of midi2abc.c which was becoming to
|
||||
large. The object of the program is to extract statistical characterisitic
|
||||
@@ -1106,7 +1106,7 @@ long ltempo;
|
||||
trkdata.tempo[0]++;
|
||||
if (noOutput == 1) return;
|
||||
if (trkdata.tempo[0] == 1) printf("tempo %6.2f bpm\n",60000000.0/tempo);
|
||||
else if (trkdata.tempo[0] < 10) printf("ctempo %6.2f %6.2f\n",60000000.0/tempo,beatnumber);
|
||||
else if (trkdata.tempo[0] < 100) printf("ctempo %6.2f %6.2f\n",60000000.0/tempo,beatnumber);
|
||||
}
|
||||
|
||||
|
||||
|
||||
9
store.c
9
store.c
@@ -186,7 +186,7 @@ int main()
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION "5.00 February 02 2025 abc2midi"
|
||||
#define VERSION "5.02 February 16 2025 abc2midi"
|
||||
|
||||
/* enables reading V: indication in header */
|
||||
#define XTEN1 1
|
||||
@@ -3775,9 +3775,10 @@ int *pitchbend;
|
||||
if ((temperament==TEMPERLN) || (temperament==TEMPEREQ)) {
|
||||
|
||||
pitchvalue = tscale[p]/100.0; /* cents to semitones */
|
||||
|
||||
/* respect accidentals when they do not occur in a microtone */
|
||||
if (acc == '^' && !microtone) pitchvalue = pitchvalue + (float) mul; /* [SS] 2025-01-12 */
|
||||
if (acc == '_' && !microtone) pitchvalue = pitchvalue - (float) mul;
|
||||
if (acc == '^' && !microtone) pitchvalue = pitchvalue + (float) (mul*accidental_size); /* [SS] 2025-02-15 */
|
||||
if (acc == '_' && !microtone) pitchvalue = pitchvalue - (float) (mul*accidental_size);
|
||||
/* printf("note = %c accidental = %c mul = %d p = %d pitchvalue = %f\n",note,accidental,mul,p,pitchvalue); */
|
||||
|
||||
pitchvalue = pitchvalue + octave*octave_size/100.0 + middle_c;
|
||||
@@ -3795,7 +3796,7 @@ int *pitchbend;
|
||||
/* microtone fraction (eg _12/53B,) */
|
||||
microtoneshift = (float) setmicrotone.num /(float) setmicrotone.denom;
|
||||
/* printf("microtoneshift = %f for setmicrotone %d %d\n",microtoneshift, setmicrotone.num,setmicrotone.denom); */
|
||||
pitchvalue += microtoneshift;
|
||||
pitchvalue += microtoneshift*accidental_size; /* [SS] 2025.02.16 */
|
||||
}
|
||||
|
||||
microtone = 0;
|
||||
|
||||
Reference in New Issue
Block a user