lilypond-user
[Top][All Lists]
Advanced

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

Re: Guitar Barre'


From: Nicolas Sceaux
Subject: Re: Guitar Barre'
Date: Thu, 28 Apr 2005 10:42:01 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Maurizio Monge <address@hidden> writes:

> Thanx, i am now triying to write a macro to realize barre 
> comfortably. I also found the following code in an older
> port, but i doesn't compile (2.5.20). What's wrong?
> I really would like to end up with a function like:
>    \barre #"IV" { c d e }
> or at least
>    \barre #"IV"  c \startTextSpan d e  \stopTextSpan
> Any suggestion?
> Thanks

The second one is the easier. The first thing to do, is to write in
plain LilyPond what you want. For instance:

{
  \once \override Voice . TextSpanner #'edge-text = #(cons "C IV" "")
  \once \override Voice . TextSpanner #'direction = #1
  \once \override Voice . TextSpanner #'edge-height = #'(0 . 0.5)
  \once \override Voice . TextSpanner #'padding = #1 
  \once \override Voice . TextSpanner #'enclose-bounds = #1
}

This gives you a pattern, and the little thing that will change from
call to call is the: #(cons "C IV" "") property. You will define a
music function that will generate the pattern, and compute
appropriately the edge-text property:

barre = #(def-music-function (parser location str) (string?)
  #{
     \once \override Voice . TextSpanner #'edge-text = 
       #$(cons (format "C ~a" str) "")
     \once \override Voice . TextSpanner #'direction = #1
     \once \override Voice . TextSpanner #'edge-height = #'(0 . 0.5)
     \once \override Voice . TextSpanner #'padding = #1 
     \once \override Voice . TextSpanner #'enclose-bounds = #1
  #})

{ c'' \barre #"IV" a' \startTextSpan b'  \stopTextSpan c'' }

Note the `$'. We also could have written:

\once \override Voice . TextSpanner #'edge-text = 
  #(cons (format "C ~a" $str) "")

or :

\once \override Voice . TextSpanner #'edge-text = 
  #(cons $(format "C ~a" str) "")

See: 10.1.5 Using LilyPond syntax inside Scheme
<http://lilypond.org/doc/v2.5/Documentation/user/out-www/lilypond/Using-LilyPond-syntax-inside-Scheme.html>

nicolas




reply via email to

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