Use the following for the octave-up function. It should also now work correctly in \relative sections (but not outside unfortunately).
#(define (octave-up m t) (let* ((octave (if (> t 0) 0 -2)) (new-note (ly:music-deep-copy m)) (new-pitch (ly:make-pitch octave (ly:pitch-notename (ly:music-property m 'pitch)) (ly:pitch-alteration (ly:music-property m 'pitch))))) (set! (ly:music-property new-note 'pitch) new-pitch) new-note)) Let me know how it works! -----Jay On Sun, Apr 27, 2008 at 8:34 PM, Jonathan Kulp <[EMAIL PROTECTED]> wrote: > Hey guys, > > Just discovered another issue with the octaves command and wondered whether > you could see an easy way out of it. When I use a cautionary accidental > inside one of these octaves blocks, it only prints the accidental on the > lower note of the 8ve pair. Any way to get it to show the accidental on > both notes of the pair? Best, > > Jon > > > > Valentin Villenave wrote: > > > > Hi Jonathan, here's the function I proposed earlier. it takes a number > > as an argument: if you want to add upper octaves, specify #1, if you > > want lower octaves, type #-1. Its very dirty and it suffers from the > > same bug (i.e. it's probably a bad idea to use it inside a \relative > > block when you have to use commas and single quotes), but hopefully > > someone will clean the code and address the issue. > > > > #(define (octave-up m t) > > (make-music 'NoteEvent > > 'duration (ly:music-property m 'duration) > > 'pitch (ly:make-pitch (+ t (ly:pitch-octave > > (ly:music-property m 'pitch))) > > (ly:pitch-notename (ly:music-property m 'pitch)) > > (ly:pitch-alteration (ly:music-property m > 'pitch))))) > > > > #(define (octavize-chord elements t) > > (cond ((null? elements) elements) > > ((eq? (ly:music-property (car elements) 'name) 'NoteEvent) > > (cons (car elements) > > (cons (octave-up (car elements) t) > > (octavize-chord (cdr elements) t)))) > > (else (cons (car elements) (octavize-chord (cdr elements ) t))))) > > > > #(define (octavize music t) > > (let* ((es (ly:music-property music 'elements)) > > (e (ly:music-property music 'element)) > > (name (ly:music-property music 'name))) > > (cond ((eq? name 'EventChord) > > (ly:music-set-property! music 'elements (octavize-chord es t))) > > ((pair? es) > > (for-each (lambda(x) (octavize x t)) es)) > > ((ly:music? e) > > (octavize e)))) > > music) > > > > octaves = #(define-music-function (parser location arg mus) (integer? > ly:music?) > > (if (> arg 0) (octavize mus 1) (octavize mus -1))) > > > > \relative { c d e \octaves #-1 { f g c }} > > > > > > Cheers, > > Valentin > > > > > > > -- > Jonathan Kulp > http://www.jonathankulp.com > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user