lilypond-user
[Top][All Lists]
Advanced

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

Re: Repeating a section with different transpose


From: David Nalesnik
Subject: Re: Repeating a section with different transpose
Date: Sat, 11 Apr 2015 10:14:56 -0500



On Fri, Apr 10, 2015 at 1:48 PM, Klaus Blum <address@hidden> wrote:
Hi Eljakim,

all I can offer you is a function to simplify things a little bit.
However, it is necessary to pass two parameters:
- a destination pitch for transposition and key signature
- a markup for use in the title

% --------------------------------------------------------------------

\version "2.18.2"

exercise =
#(define-music-function (parser location p str) (ly:pitch? markup?)
   #{
     \new GregorianTranscriptionStaff
     \clef treble
     \key $p \major
     \omit Staff.TimeSignature
     \transpose c $p {
       \relative c'
       {
         \mark \markup {"Exercise in" $str "major" }
         c8[ d] e [f]
       }
     }
     \pageBreak

   #})


\score {\exercise c "C" }
\score {\exercise d "D" }
\score {\exercise e "E" }

% --------------------------------------------------------------------

It would be cool to have a function that turns a pitch into a markup, but I
had no luck so far.

You could adapt your function like this:

 % --------------------------------------------------------------------
#(use-modules (scm display-lily))

\version "2.18.2"

exercise =
#(define-music-function (parser location p) (ly:pitch?)
   (let ((str (string-capitalize 
               (symbol->string (note-name->lily-string p parser)))))
     #{
       \new GregorianTranscriptionStaff
       \clef treble
       \key $p \major
       \omit Staff.TimeSignature
       \transpose c $p {
         \relative c'
         {
           \mark \markup {"Exercise in" $str "major" }
           c8[ d] e [f] s2
         }
       }
       \pageBreak

     #}))


\score {\exercise c }
\score {\exercise d }
\score {\exercise e }

% --------------------------------------------------------------------


--David

reply via email to

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