lilypond-user
[Top][All Lists]
Advanced

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

Re: Help defining commands


From: Nicolas Sceaux
Subject: Re: Help defining commands
Date: Sun, 30 Nov 2003 20:52:16 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Mon, 24 Nov 2003 22:10:39 -0800, Guy a dit : 

 > I'm trying to typeset music for classical guitar for which I need
 > to be able to produce the barre  
 > symbol. I've managed to acheive the desired output with text
 > spanners via the code: 

 > \property Voice.TextSpanner \set #'edge-text = #'("C II " . "")
 > \property Voice.TextSpanner \set #'direction = #1
 > \property Voice.TextSpanner \set #'style = #'line
 > \property Voice.TextSpanner \set #'edge-height = #'(0 . 0.5)
 > \property Voice.TextSpanner \set #'padding = #1
 > \property Voice.TextSpanner \set #'enclose-bounds = ##t

 > c''\startTextSpan ..... \stopTextSpan

 > I'de like to define this as a pair of commands. The first would be
 > \statBarre which would take as  
 > a parameter the barre position, say \startBarre "IV". The position
 > has to be concatinated with the  
 > "C" symbol and replaced as the first parameter in the edge-text
 > property. The second command  
 > is a simple \stopBarre which I think I can do by just defining:

 > stopBarre = \stopTextSpan.

 > Thanks. 

Supposing one is using the extra lib[1] that I mentionned in a reply to
Paul Scott, here what it could look like :

------------------------------------------------------------
#(use-modules (ice-9 optargs)
              (srfi srfi-13)
              (lilypond music))

#(define (barre str)
  (ly:export 
    (mus:seq
     (mus:context-override Voice TextSpanner edge-text 
       (cons (string-concatenate (list "C " str)) "") #:once #t)
     (mus:context-override Voice TextSpanner direction 1 #:once #t)
     (mus:context-override Voice TextSpanner style 'line #:once #t)
     (mus:context-override Voice TextSpanner edge-height '(0 . 0.5)
                           #:once #t) 
     (mus:context-override Voice TextSpanner padding 1 #:once #t)
     (mus:context-override Voice TextSpanner enclose-bounds #t 
                           #:once #t)))) 

\score { \notes {
    c' c'#(barre "II") c'\startTextSpan c'\stopTextSpan
    c' c'#(barre "IV") c'\startTextSpan c'\stopTextSpan }}
------------------------------------------------------------

I don't think that it is possible to put property overrides between
the note and the span event, that's why the `barre' function only sets
the properties.

[1] http://nicolas.sceaux.free.fr/schemingly/scheme-hacks.html


Regards,
nicolas





reply via email to

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