diff --git a/VERSION b/VERSION index 6b76cdd..89e8a23 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -February 25 2024 +March 03 2024 diff --git a/doc/CHANGES b/doc/CHANGES index ccc45b5..1b71f87 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -15379,7 +15379,7 @@ Fix: commented out the line in isclef() which zeros the octave_offset. February 25 2024 -abcmidi note: +abc2midi note: Besides clef=treble-8, the abcmidi 2.2 standard also recognizes clef=treble_8, clef=treble^8 and etc. These clefs do not transpose @@ -15396,3 +15396,57 @@ It is necessary to use the new function, readword_with_() which does not break the string on encountering either the underscore _ or caret ^. + +March 02 2024 + +abc2midi deviance from abc standard 2.2 + +The clef=, octave=, and transpose= in the V: command are +expected to be persistant and independent of each other. They +are changed independently any time a new clef=, octave=, +or transpose= appears. These are stored in 3 variables. +And the pitch of a note is assigned the sum of these values. + +Analysis: +event_note computes the midi pitch from note (one of a,b,c,d,e,f,g), +the xoctave, clef, accidental, and mult which are all input +parameters to that function. In addition it accesses the global +voice structure v of the active voice to get the octaveshift +for that voice. The function computes the local variable octave +from xoctave, clef->octave_offset and v->octaveshift. + +Prior to this fix and since May 21 2021, the local variable +octave was either assigned to the value of +clef->octave_offset + xoctave or to v->octaveshift + xoctave when +v->octaveshift is nonzero. In addition, event_voice also changes +v->octaveshift when it encounters a new clef=. + +Fix: + +In order to comply with this standard, the code in event_voice +was modified to prevent clef= from modifying v->octaveshift. In +addition event_note now computes octave as below. + octave = clef->octave_offset + v->octaveshift + xoctave; /*[SS] 2024-03-02*/ + +Note this is a significant change as it could break some abc +files. For example, if the user put clef=treble+8 and also +octave=+1, just to be safe, then the resulting octave would be higher +than expected. Fortunately, octave= is still rarely used. + +Here is the test file for verifying this fix. + +X:1 +T:Test for octave shifts in sound +M:4/4 +K:C +% The following seven notes should have equal sound +V:1 clef=treble +d8 |\ +[V:1 clef=treble+8] D8 |\ +[V:1 octave=-1] d8 |\ +[V:1 transpose=12] D8 |\ +[V:1 clef=treble] d8 |\ +[V:1 octave=0] D8 |\ +[V:1 transpose=0] d8 |] + + diff --git a/doc/readme.txt b/doc/readme.txt index dc25aa7..cfc479c 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.59 February 08 2023 -abc2midi version 4.90 February 25 2024 +abc2midi version 4.91 March 02 2024 abc2abc version 2.21 February 19 2024 yaps version 1.93 February 19 2024 abcmatch version 1.83 February 19 2024 diff --git a/store.c b/store.c index 011ae5c..6b43d43 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.90 February 25 2024 abc2midi" +#define VERSION "4.91 March 02 2024 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -2976,10 +2976,11 @@ struct voice_params *vp; v = getvoicecontext(n); addfeature(VOICE, v->indexno, 0, 0); - if (vp->gotclef) + /*****if (vp->gotclef) { event_octave(vp->new_clef.octave_offset, 1); - } + }*** [SS] 2024-03.02 */ + if (vp->gotoctave) { event_octave(vp->octave,1); }; @@ -4304,11 +4305,16 @@ int xoctave, n, m; event_fatal_error("Internal error - no voice allocated"); }; if (gracenotes && ignore_gracenotes) return; /* [SS] 2010-01-08 */ - if (v->octaveshift == 0) { /* [JA] 2021-05-21 */ + +/* [SS] 2024-03-02 + printf("clef->octave_offset = %d v->octaveshift = %d\n",clef->octave_offset,v->octaveshift); + if (v->octaveshift == 0) { [JA] 2021-05-21 octave = xoctave + clef->octave_offset; } else { octave = xoctave + v->octaveshift; } +*/ + octave = clef->octave_offset + v->octaveshift + xoctave; /*[SS] 2024-03-02*/ num = n; denom = m; if (v->inchord) v->chordcount = v->chordcount + 1;