lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme music function attempt


From: Carl D. Sorensen
Subject: Re: Scheme music function attempt
Date: Mon, 26 Jan 2009 06:09:08 -0700



On 1/26/09 3:08 AM, "Tao Cumplido" <address@hidden> wrote:

> Yes, that helped a lot. Thanks!
> That's how I made the first step work now, in case of interest.

Great!

> 
> #(define (root-name music)
>    (let* ((e (car (ly:music-property music 'elements)))
>           (p (ly:music-property e 'pitch)))
>      (if (ly:pitch? p)
>          (let ((n (ly:pitch-notename p)))
>            (if (number? n)
>                (number->string n))))))
>                 
> cs = #(define-music-function (parser location pitch) (ly:music?)
>         (let ((rn (root-name pitch)))
>           #{ \mark \markup { $rn } #}))
> 
> \new Staff { c'1 \cs c'1 c'1 }
> 

You may want to use a different name from cs.  cs is C sharp in english, so
this code would run into the same problem as you had before with c if
somebody wants to use english note names.

> Also I didn't know about the scheme-way of using display.
> It'll make trying out a lot easier.

That's why I wanted to show it to you, and copied it to Frogs.  Thanks for
giving me a good opportunity to put together a mini example.  It'll go in
the CG somewhere, I suppose.  Or maybe in the Learning Manual on Scheme
Programming.

Good luck!

Carl





reply via email to

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