2025.02.15

This commit is contained in:
sshlien
2025-02-15 20:12:53 -05:00
parent 5054b25701
commit 907c8fa19f
6 changed files with 59 additions and 19 deletions

View File

@@ -1 +1 @@
February 07 2025
February 15 2025

View File

@@ -15614,3 +15614,33 @@ 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);

View File

@@ -1,7 +1,7 @@
abcMIDI : abc <-> MIDI conversion utilities
midi2abc version 3.62 February 06 2025
abc2midi version 5.00 February 12 2025
midi2abc version 3.63 February 13 2025
abc2midi version 5.01 February 15 2025
abc2abc version 2.22 April 30 2024
yaps version 1.94 April 30 2024
abcmatch version 1.83 February 19 2024

View File

@@ -45,7 +45,7 @@
* based on public domain 'midifilelib' package.
*/
#define VERSION "3.62 February 07 2025 midi2abc"
#define VERSION "3.63 February 13 2025 midi2abc"
#include <limits.h>
/* Microsoft Visual C++ Version 6.0 or higher */
@@ -703,19 +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);
*/
/*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);
@@ -1004,21 +1008,26 @@ int cents,centvalue,pitchbend;
int newpitchint;
float newpitch,fcents;
start_time = close_note(chan, pitch, &initvol);
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("%f\t%d\t%d\n",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;

View File

@@ -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;

View File

@@ -186,7 +186,7 @@ int main()
*/
#define VERSION "5.00 February 02 2025 abc2midi"
#define VERSION "5.01 February 15 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;