[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Staff customization question.
From: |
Hwaen Ch'uqi |
Subject: |
Re: Staff customization question. |
Date: |
Wed, 6 Jan 2016 00:15:43 -0500 |
Greetings Paul,
This is EXACTLY what I was looking for: Thank you so much!
Hwaen Ch'uqi
On 1/5/16, Paul Morris <address@hidden> wrote:
>> On Jan 5, 2016, at 11:03 AM, Hwaen Ch'uqi <address@hidden> 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’
> }
>
>
>
>
>