diff --git a/VERSION b/VERSION index e28a4be..4b29c29 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -December 27 2022 +December 30 2022 diff --git a/doc/CHANGES b/doc/CHANGES index 020e691..408ee96 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -14951,6 +14951,28 @@ an extra parameter, word, indicating the type of directive. It will issue a warning if it detects a '/' in the sound= or shift= directives. - +December 30 2022 + +abcmidi: The instrument=*/c is a special directive that suppresses +a transpose. For example: + +X:2 +T: transpose using instrument=_B/c +T: clarinet coded in concert pitch, displayed in Bb (as in player part) +M: 4/4 +L: 1/4 +K: C +V:1 nm="Flute" +CDEF|GABc|cBAG|FEDC| +V:2 instrument=_B/c nm="Clarinet\nin Bb" +CDEF|GABc|cBAG|FEDC| + +The notes in V:2 are displayed up using score=_Bc, but they are still +played as written (sound=cc does nothing). +Fix: the code in the block +if (casecmp(word,"instrument") == 0 { +... +} +in parsesound() (parseabc.c) was rewritten. diff --git a/doc/readme.txt b/doc/readme.txt index 44cfac4..78c7916 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.58 December 09 2022 -abc2midi version 4.78 December 27 2022 +abc2midi version 4.80 December 30 2022 abc2abc version 2.18 June 14 2022 yaps version 1.90 June 14 2022 abcmatch version 1.82 June 14 2022 diff --git a/parseabc.c b/parseabc.c index be6995b..58c4558 100644 --- a/parseabc.c +++ b/parseabc.c @@ -1022,8 +1022,7 @@ parsetranspose (s, word, gottranspose, transpose) }; /* [SS] 2021-10-11 */ -int -parsesound (s, word, gottranspose, transpose) +int parsesound (s, word, gottranspose, transpose) /* parses string sound = shift = instrument = note1note2 or note1/note2 @@ -1054,15 +1053,25 @@ parsesound (s, word, gottranspose, transpose) p2 = note2midi (s,word); /*printf("p2 midi note = %d\n",p2);*/ - if (p2 == p1) { - p2 = 72; /* [SS] 2022.12.21 */ + if (p2 == p1 || p2 == 0) { + *transpose = 72 - p1; /* [SS] 2022.12.30 */ } if (casecmp(word,"instrument") == 0) { /*2022.12.27 */ *transpose = p1 - p2; /* [SS] 2022.02.18 2022.04.27 */ + if (p2 == 0) { /* is missing */ + *transpose = p1 - 72; + } + if (p2 == p1 || p2 == 0) { + *transpose = p1 - 72; /* [SS] 2022.12.30 */ + } + if (p2 == 72 && fileprogram == ABC2MIDI) { + *transpose = 0; + } /* [SS] 2022.12.30 */ } else { *transpose = p2 - p1; /* [SS] 2022.02.18 2022.04.27 */ } *gottranspose = 1; + /*printf("p1 = %d p2 = %d transpose = %d\n",p1,p2,*transpose);*/ } return 1; } @@ -2752,8 +2761,7 @@ return p; /* [SS] 2021-10-11 */ -int -note2midi (char** s, char *word) +int note2midi (char** s, char *word) { /* for implementing sound=, shift= and instrument= key signature options */ @@ -2865,7 +2873,7 @@ switch (**s) } if (note == ' ') { - event_error ("Malformed note : expecting a-g or A-G"); + return 0; } pitch = pitch2midi(note, accidental, mult, octave); return pitch; diff --git a/store.c b/store.c index a101d50..ef3aab3 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.78 December 27 2022 abc2midi" +#define VERSION "4.80 December 30 2022 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1