Transposing pitches with minimum accidentals (“smart” transpose): Difference between revisions
Import snippet from LSR |
mNo edit summary |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply: | This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply: | ||
* double accidentals should be removed | |||
* b sharp → c | |||
* e sharp → f | |||
* c flat → b | |||
* f flat → e | |||
In this manner, the most natural enharmonic notes are chosen. | In this manner, the most natural enharmonic notes are chosen. | ||
<lilypond version="2.24 | <lilypond version="2.24"> | ||
#(define (naturalize-pitch p) | #(define (naturalize-pitch p) | ||
(let ((o (ly:pitch-octave p)) | (let ((o (ly:pitch-octave p)) | ||
| Line 75: | Line 71: | ||
[[Category:Workaround]] | [[Category:Workaround]] | ||
[[Category:Scheme]] | [[Category:Scheme]] | ||
[[Category:Snippet]] | |||