Am 01.12.2015 um 15:48 schrieb Gilles THIBAULT: >> OK, this one is more straightforward... > ...but your idea was probably the best :
:-) Thank you for your input and sorry I didn't have time to reply earlier. Maybe "best" is also a matter of use case here, but I have the impression that in this case a simple lookup *is* the most straightforward solution. In the light of your suggestions I would add a second lis producing flats instead of sharps, though. Still I think there should be a built-in solution. When LilyPond does transpositions and similar operations doesn't it work on semitones either, converting to and from? Urs > > %%%%%%%%%%%%%%%%%%%% > #(define (semitones->pitch semitone) > (let ((index (modulo semitone 12)) > (octave (quotient semitone 12))) > (apply ly:make-pitch (cons > octave > (list-ref > '((0 0) ; c > (0 1/2) ; cis > (1 0) ; d > (1 1/2) ; dis > (2 0) ; e > (3 0) ; f > (3 1/2) ; fis % \jiPitch 2 1 > > (4 0) ; g > (4 1/2) ; gis > (5 0) ; a > (5 1/2) ; ais > (6 0)) ; b > index))))) > > %%test > > #(for-each > (lambda(n)(format #t "~2,' d - ~a\n" n (semitones->pitch n))) > '(-5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) > %%%%%%%%%%%%%%%%%%%%%% > > -- The End --- > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user