lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keyboard chord figure in scheme


From: Carl Sorensen
Subject: Re: Keyboard chord figure in scheme
Date: Wed, 18 Jan 2012 01:55:05 +0000
User-agent: Microsoft-MacOutlook/14.10.0.110310

On 1/17/12 2:30 PM, "Morten Jagd Christensen" <address@hidden> wrote:

>Hello all
>
>I'm trying to make a scheme function that generates a keyboard with
>black and white dots for showing specific chord layouts
>
>The code below compiles and produces the keyboard figure
>
>I then call a function (make-dot key) which works fine. What I really
>want is
>(make-dot-list '(1 5 8))  which should produce a black dot on c, a white
>dot on ees and a
>black dot on g (for a C major chord).
>
>I suspect that somehow only the last empty-stencil is returned but have
>been unable
>to solve my problem.
>
>Does anyone have a suggestion how to solve this?


First of all, congratulations on this attempt. It's very good.

You are correct.  You are only returning the empty stencil.

You need the following:

#(define (make-dot-list l1)
   (if (null? l1) 
       empty-stencil
       (ly:stencil-add (make-dot (car l1)
                       (make-dot-list (cdr l1))))

This way, you are adding all the stencils.  Previously, you were not doing
anything with the make-dot stencil.  It was getting created, then thrown
away.


Good luck!


Carl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]