[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In octaves
From: |
Jay Anderson |
Subject: |
Re: In octaves |
Date: |
Sun, 27 Apr 2008 21:15:11 -0700 |
> Let me know how it works!
A couple more changes:
#(define (octave-up m t)
(let* ((octave (1- t))
(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))
#(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?)
(octavize mus arg))
Now you can do silly things like: \relative c'{ \octaves #2 {c d e f'
g,,} } and it will make the new note two octaves up. I'm not sure why
you'd want that, but it seemed easy enough to do (and takes slightly
less code).
-----Jay
- Re: In octaves, (continued)
- Re: In octaves, Valentin Villenave, 2008/04/24
- Re: In octaves, Jonathan Kulp, 2008/04/24
- Message not available
- Re: In octaves, Valentin Villenave, 2008/04/24
- Re: In octaves, Jonathan Kulp, 2008/04/24
- Re: In octaves, Valentin Villenave, 2008/04/24
- Re: In octaves, Jonathan Kulp, 2008/04/24
- Re: In octaves, Jay Anderson, 2008/04/24
- Re: In octaves, Valentin Villenave, 2008/04/25
- Re: In octaves, Jonathan Kulp, 2008/04/27
- Re: In octaves, Jay Anderson, 2008/04/28
- Re: In octaves,
Jay Anderson <=
- Re: In octaves, Jonathan Kulp, 2008/04/28