Greetings Paul, This is EXACTLY what I was looking for: Thank you so much!
Hwaen Ch'uqi On 1/5/16, Paul Morris <p...@paulwmorris.com> wrote: >> On Jan 5, 2016, at 11:03 AM, Hwaen Ch'uqi <hwaench...@gmail.com> wrote: >> >> Yes, I had seen this snippet before. It appears though that this >> function assumes a certain regularity - i.e., by semitones, whole >> tones, etc. In this case, the intervals between pitches are not >> uniform, varying from minor seconds to major thirds. Will this take a >> list of numbers to define each line and space? If so, can I simply >> plug in a series of numbers, or must they be surrounded by parentheses >> and a hash or something? I am quite nervous with Scheme! > > For your use-case I would just use a lookup-table (alist) that maps > semitones to staff positions, as shown in the snippet below. > > HTH, > -Paul > > > \version "2.18" > > #(define (my-procedure pitch) > (let > ;; get the semitone of the pitch > ((semitone (ly:pitch-semitones pitch)) > ;; lookup-alist maps semitones to positions on the staff > (lookup-alist > '((0 . 0) > (2 . 3) > (4 . 6) > (5 . 9) > ;; ...edit and add more here as needed > ))) > ;; for development / debugging to see what semitones you are working > with > (display semitone)(newline) > ;; lookup the position and return the position that goes with it > (assoc-ref lookup-alist semitone))) > > \new Staff \with { > staffLineLayoutFunction = #my-procedure > } { > c'4 d' e' f’ > } > > > > > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user