[frogs] Re: Scheme music function attempt |
[ Thread Index |
Date Index
| More lilynet.net/frogs Archives
]
On 1/26/09 3:08 AM, "Tao Cumplido" <tao_lilyponduser@xxxxxxx> 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
---
----
Join the Frogs!