lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme function


From: Nathan Ho
Subject: Re: Scheme function
Date: Wed, 10 Jun 2015 10:04:21 -0700

On Wed, Jun 10, 2015 at 7:17 AM, Víctor <address@hidden> wrote:
Hi all:

solfa =
#(define-music-function
    (parser location framed number note)
    (string? string? string?)
  #{
    ^\markup{
      \box
      \pad-to-box #'(0 . 0) #'(0 . 2.2){ #framed }
      #number :
      \italic #note
    }
  #})

\relative c' { c4^\solfa "C" "I" "do" }

I need this function to stop drawing the box when first argument is "" or stop printing the ":" when second or third argument are "". I'm very new to Scheme and any help is very much apreciated.

Regards,
Víctor.

Hi Victor,

Here's one way to do it:

solfa =
#(define-music-function
    (parser location framed number note)
    (string? string? string?)
  (make-music
    'TextScriptEvent
    'direction 1
    'text
    (markup
       (if (not (equal? framed ""))
          (markup #:box #:pad-to-box '(0 . 0) '(0 . 2.2) framed)
          "")
        #:simple number
        (if (not (or (equal? number "") (equal? note "")))
          (markup #:simple ":")
          "")
        #:italic note)))

\relative c' {
  c1^\solfa "C" "I" "do"
  c1^\solfa "" "I" "do"
  c1^\solfa "C" "" "do"
  c1^\solfa "C" "I" ""
}

Regards,
Nathan

reply via email to

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