Compare commits

...

1 Commits

Author SHA1 Message Date
sshlien
659270b0c9 2025.01.04 2025-01-04 21:01:08 -05:00
4 changed files with 112 additions and 8 deletions

View File

@@ -1 +1 @@
December 22 2024
January 04 2025

View File

@@ -15490,3 +15490,39 @@ abc2midi: corrections to the sus, sus4, sus2 and sus9 chords provided
by Avik Topchyan were incorporated in the function setup_chordnames()
into store.c
January 3 2025
abc2midi: it was recently discovered that abc2midi does not respect
the microtone key signature when dealing with Turkish makams.
In the sample file
X:1
T: Microtone key signature
M: 4/4
L: 1/4
%%MIDI temperamentequal 53
K: C
B,2 D2|\
_1B,2 _4D2|
K: C _1B _4D
B,2 D2|
The last bar B,2 D2 should be played as _1B,2 _4D.
Fix: most of the code dealing with the microtone key signature
was already present in the function pitchof_b, however the
implementation was not complete. In order to complete the
implementation, the pitchof_b detects whether the note is
under the influence of the key signature and invokes event_microtone()
when necessary. The pitch shift is then applied just as if
the microtone was already present in the note.
Comment: the code dealing with microtones is very messy. The
function pitchof_b is more than 120 lines of code because it
also handles trills, and other note decorations. Information
is passed around through global variables like workmic, workmap,
note, pitchbend, microtone, setmicrotone. event_microtone
is called before event_note. It is hard to determine what is
going on. Many people have worked on this code.

54
doc/programming/eq53.txt Normal file
View File

@@ -0,0 +1,54 @@
This table may be useful when working with TET-53 abc files
n = 1 pitch = 60 bentpitch = 7960 C
n = 2 pitch = 60 bentpitch = 8888 ^1C
n = 3 pitch = 60 bentpitch = 9815 ^2C
n = 4 pitch = 61 bentpitch = 6646 ^3C
n = 5 pitch = 61 bentpitch = 7574 ^4C
n = 6 pitch = 61 bentpitch = 8501 _4D
n = 7 pitch = 61 bentpitch = 9429 _3D
n = 8 pitch = 62 bentpitch = 6260 _2D
n = 9 pitch = 62 bentpitch = 7187 _1D
n = 10 pitch = 62 bentpitch = 8115 D
n = 11 pitch = 62 bentpitch = 9042 ^1D
n = 12 pitch = 62 bentpitch = 9970 ^2D
n = 13 pitch = 63 bentpitch = 6801 ^3D
n = 14 pitch = 63 bentpitch = 7728 ^4D
n = 15 pitch = 63 bentpitch = 8656 _3E
n = 16 pitch = 63 bentpitch = 9583 _2E
n = 17 pitch = 64 bentpitch = 6414 _1E
n = 18 pitch = 64 bentpitch = 7342 E
n = 19 pitch = 64 bentpitch = 8269 ^1E
n = 20 pitch = 64 bentpitch = 9197 ^2E
n = 21 pitch = 64 bentpitch = 10124 ^2E
n = 22 pitch = 65 bentpitch = 6955 ^3E
n = 23 pitch = 65 bentpitch = 7883 F
n = 24 pitch = 65 bentpitch = 8810 ^1F
n = 25 pitch = 65 bentpitch = 9738 ^2F
n = 26 pitch = 66 bentpitch = 6569 ^3F
n = 27 pitch = 66 bentpitch = 7496 ^4F
n = 28 pitch = 66 bentpitch = 8424 _4G
n = 29 pitch = 66 bentpitch = 9351 _3G
n = 30 pitch = 67 bentpitch = 6183 _2G
n = 31 pitch = 67 bentpitch = 7110 _1G
n = 32 pitch = 67 bentpitch = 8037 G
n = 33 pitch = 67 bentpitch = 8965 ^1G
n = 34 pitch = 67 bentpitch = 9892 ^2G
n = 35 pitch = 68 bentpitch = 6724 ^3G
n = 36 pitch = 69 bentpitch = 6337 _4A
n = 37 pitch = 68 bentpitch = 7651 _3A
n = 38 pitch = 68 bentpitch = 8578 _3A
n = 39 pitch = 68 bentpitch = 9506 _2A
n = 40 pitch = 69 bentpitch = 7265 _1A
n = 41 pitch = 69 bentpitch = 8192 A
n = 42 pitch = 69 bentpitch = 9119 ^1A
n = 43 pitch = 69 bentpitch = 10047 ^2A
n = 44 pitch = 70 bentpitch = 6878 ^3A
n = 45 pitch = 70 bentpitch = 7806 ^4A
n = 46 pitch = 70 bentpitch = 8733 _4B
n = 47 pitch = 70 bentpitch = 9660 _3B
n = 48 pitch = 71 bentpitch = 6492 _2B
n = 49 pitch = 71 bentpitch = 7419 _1B
n = 50 pitch = 71 bentpitch = 8347 B
n = 51 pitch = 71 bentpitch = 9274 ^1B
n = 52 pitch = 71 bentpitch = 10201 ^2B
n = 53 pitch = 72 bentpitch = 7033 _1c

28
store.c
View File

@@ -186,7 +186,7 @@ int main()
*/
#define VERSION "4.96 December 22 2024 abc2midi"
#define VERSION "4.97 January 03 2025 abc2midi"
/* enables reading V: indication in header */
#define XTEN1 1
@@ -3708,6 +3708,7 @@ int *pitchbend;
char acc;
int mul, noteno;
float pitchvalue;
float microtoneshift; /* [SS] 2025-01-03 */
int pitch,bend;
int a,b;
int j;
@@ -3729,13 +3730,26 @@ int *pitchbend;
mul = mult;
noteno = (int)note - 'a';
/* [SS] 2015-08-18 */
if (acc == ' ' && !microtone) { /* no accidentals, apply current state */
acc = v->workmap[noteno][octave+4];
mul = v->workmul[noteno][octave+4];
a = v->workmic[noteno][octave+4].num; /* 2014-01-26 */
b = v->workmic[noteno][octave+4].denom;
event_microtone(1,a,b);
/* [SS} 2025-01-03
if the key signature contains microtones which applies to the
note, we call event_microtone which will return the globals
microtone, setmicrotone.num and setmicrotone.denom and
they are applied to the note.
*/
if(a != 0) {
/* [SS] 2025-01-03 */
//printf("calling event_microtone from pitchof_b\n");
event_microtone(1,a,b);
}
} else { /* some accidentals save the state if propagate_accs != 0 */
if (propagate_accs) {
if (propagate_accs == 1) { /* accidentals applies to only current octave */
@@ -3762,8 +3776,6 @@ int *pitchbend;
if ((temperament==TEMPERLN) || (temperament==TEMPEREQ)) {
pitchvalue = tscale[p]/100.0; /* cents to semitones */
if (acc == '^') pitchvalue = pitchvalue + mul*accidental_size;
if (acc == '_') pitchvalue = pitchvalue - mul*accidental_size;
pitchvalue = pitchvalue + octave*octave_size/100.0 + middle_c;
@@ -3779,7 +3791,9 @@ int *pitchbend;
* or
* microstep_size is the octave fraction for temperamentequal
* */
pitchvalue += setmicrotone.num * microstep_size/100.0;
/* [SS] 2025-01-03 */
microtoneshift = setmicrotone.num * microstep_size/100.0;
pitchvalue += microtoneshift;
}
else /* microtone relative to sharp step in the current temperament */
@@ -4328,9 +4342,10 @@ 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
/*#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;
@@ -4798,7 +4813,6 @@ struct fraction modmic[7];
v->basemul[i] = modmul[i];
v->basemic[i].num = modmic[i].num;
v->basemic[i].denom = modmic[i].denom;
/*printf("basemic[%d] = %d %d\n",i,modmic[i].num,modmic[i].denom);*/
};
};
}