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: Morten Jagd Christensen
Subject: Re: Keyboard chord figure in scheme
Date: Wed, 18 Jan 2012 09:16:51 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

Hi Carl

Thanks for the hint - I guess it wasn't clear to me when and where ly:stencil-add was
needed.

Now the code works, although there still are som FIXME's. For example the black keys
are generated by thick lines, but unfortunately they have rounded caps.

But I have submitted my code to the snippet repository any way, so hopefully
others can benefit from your help too.

Cheers

/Morten



On 18/1/12 2:55 AM, Carl Sorensen wrote:
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]