2025.01.07

This commit is contained in:
sshlien
2025-01-07 13:06:04 -05:00
parent 659270b0c9
commit 8d5df56596
5 changed files with 55 additions and 31 deletions

View File

@@ -1 +1 @@
January 04 2025
January 07 2025

View File

@@ -15526,3 +15526,34 @@ is called before event_note. It is hard to determine what is
going on. Many people have worked on this code.
January 07 2025
abc2midi: works correctly with microtone shortcuts but does not
handle the fraction expression of microtones. eg.
X:1
T: equaltempered 53
M: 4/4
L: 1/4
%%MIDI temperamentequal 53
K: none
C ^12/53C ^24/53C ^36/53C |^48/53C _48/53D _36/53D _24/53D |_12/53D =D ^12/53D ^24/53D| ^36/53D ^48/53D _48/53E _36/53E |
_24/53E _12/53E =E ^12/53E | ^24/53E ^36/53E F ^12/53F| ^24/53F ^36/53F ^48/53F _48/53G| _36/53G _24/53G _12/53G =G |
^12/53G ^24/53G ^36/53G ^48/53G| _48/53A _36/53A _24/53A _12/53A | A ^12/53A ^24/53A ^36/53A| ^48/53A _48/53B _36/53B _24/53B|
_12/53B =B ^12/53B ^24/53B _12/53c|
Fix: there were numerous minor fixes to ensure that the variable
setmicrotone.denom is initialized to 1 rather than 0 (to avoid division
by 0). New code was inserted in pitchof_b() in store.c.
if (microtone) {
/* [SS] 2025-01-03 2025-01-06*/
if (setmicrotone.denom == 1)
/* microtone shortcut (eg _1B,) */
microtoneshift = setmicrotone.num * microstep_size/100.0;
else
/* microtone fraction (eg _12/53B,) */
microtoneshift = (float) setmicrotone.num /(float) setmicrotone.denom;
In addition event_key was not receiving negative fractional microtones.
The problem was traced to a missing check in process_microtones()
in parseabc.c

View File

@@ -1,7 +1,7 @@
abcMIDI : abc <-> MIDI conversion utilities
midi2abc version 3.59 February 08 2023
abc2midi version 4.96 December 16 2024
abc2midi version 4.98 January 07 2025
abc2abc version 2.22 April 30 2024
yaps version 1.94 April 30 2024
abcmatch version 1.83 February 19 2024

View File

@@ -674,7 +674,7 @@ ismicrotone (p, dir)
return 1;
}
setmicrotone.num = 0;
setmicrotone.denom = 0;
setmicrotone.denom = 1;
return 0;
}
@@ -1347,6 +1347,7 @@ static void process_microtones (int *parsed, char word[],
if (j > 7) {
j = (int) c - 'a';
}
if (word[0] == '_') a = -a; /* [SS] 2025-01-07 */
if (j > 7 || j < 0) {
event_error ("Not a valid microtone");
return;

48
store.c
View File

@@ -186,7 +186,7 @@ int main()
*/
#define VERSION "4.97 January 03 2025 abc2midi"
#define VERSION "4.98 January 07 2025 abc2midi"
/* enables reading V: indication in header */
#define XTEN1 1
@@ -3746,9 +3746,7 @@ int *pitchbend;
*/
if(a != 0) {
/* [SS] 2025-01-03 */
//printf("calling event_microtone from pitchof_b\n");
event_microtone(1,a,b);
event_microtone(1,a,b); /* [SS] 2025-01-03 */
}
} else { /* some accidentals save the state if propagate_accs != 0 */
if (propagate_accs) {
@@ -3782,28 +3780,23 @@ int *pitchbend;
/* [HL] 2020-06-27 Adjust for A=440.0 with zero pitchbend */
pitchvalue += 9.0 - (3.0*fifth_size-octave_size)/100.0;
/* [HL] 2015-05-15 */
/* [HL] 2015-05-15 2025-01-06*/
if (microtone) {
if (setmicrotone.denom == 100) /* microtone in cents */
pitchvalue+= setmicrotone.num / 100.0; /* [HL] 2020-07-28 */
else if (setmicrotone.denom == 0) { /* [HL] 2020-06-20 / 2020-06-27 */
/* microstep_size is accidental_size for temperamentlinear,
* or
* microstep_size is the octave fraction for temperamentequal
* */
/* [SS] 2025-01-03 */
microtoneshift = setmicrotone.num * microstep_size/100.0;
pitchvalue += microtoneshift;
/* [SS] 2025-01-03 2025-01-06*/
if (setmicrotone.denom == 1)
/* microtone shortcut (eg _1B,) */
microtoneshift = setmicrotone.num * microstep_size/100.0;
else
/* 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;
}
else /* microtone relative to sharp step in the current temperament */
pitchvalue += (((float)setmicrotone.num) / ((float)setmicrotone.denom)) * accidental_size; /* [HL] 2020-07-28 */
/* needed? */
microtone = 0;
setmicrotone.num = setmicrotone.denom = 0;
setmicrotone.num = 0;
setmicrotone.denom = 1; /* [SS] 2025-01-06 */
active_pitchbend = 8192;
}
pitch = (int) (pitchvalue + 0.5);
bend = (int) (0.5 + 8192.0 + 4096.0 * (pitchvalue - (float) pitch));
@@ -3822,13 +3815,14 @@ int *pitchbend;
if (!microtone) *pitchbend = bend; /* don't override microtone */
/* if (comma53) [SDG] 2020-06-03 ambiguous statement
* should the following lines be included in if statement? */
#ifdef MAKAM
/*#ifdef MAKAM
if (comma53) fprintf(fc53,"%c%d ",note,octave+4);
#endif
*/
if (comma53) convert_to_comma53 (acc, &pitch, pitchbend);
microtone = 0; /* [SS] 2014-01-25 */
setmicrotone.num = 0; /* [SS] 2014-01-25 */
setmicrotone.denom = 0;
setmicrotone.denom = 1; /* [SS] 2025-01-06 */
return pitch;
}
@@ -4342,10 +4336,6 @@ int xoctave, n, m;
if (v->drumchannel) pitch = barepitch(note,accidental,mult,octave);
/* [SS] 2015-08-18 */
pitch = pitchof_b(note, accidental, mult, octave, propagate_accidentals,&active_pitchbend);
/*#ifndef MAKAM
pitch_noacc = pitchof_b(note, 0, 0, octave, 0,&dummy);
#endif
*/
if (decorators[FERMATA] && !ignore_fermata) {
if(fermata_fixed) addfract(&num,&denom,1,1);
else num = num*2;
@@ -4455,7 +4445,7 @@ setmicrotone.denom = b;
if (a == 0) {bend = 8192; /* [SS] 2014-01-19 */
microtone = 0; /* [SS] 2014-01-20 */
setmicrotone.num = 0; /* [SS] 2014-01-25 */
setmicrotone.denom = 0;
setmicrotone.denom = 1; /* [SS] 2025-01-06 */
return;
}
else {
@@ -4464,6 +4454,8 @@ else {
}
active_pitchbend = bend;
microtone=1;
if (b == 0) setmicrotone.denom = 1; /* [SS] 2025-01-06 */
return;
}