lilypond-user
[Top][All Lists]
Advanced

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

rewriting function that takes music expression into two enclosing \...Be


From: Janek Warchoł
Subject: rewriting function that takes music expression into two enclosing \...Begin and \...End commands
Date: Wed, 27 Aug 2014 21:19:28 +0200

Hi,

i have something like this:

divided =
#(define-music-function (parser location music)
   (ly:music?)
   #{
     \voiceOne
     \new Voice { \voiceTwo #music }
     \oneVoice
   #})

musI = \relative f' {
  g b a b
  c b a b
}

musII = \relative f' {
  e4 g f g
  \divided {
    f2 f
  }
}

\score {
  \new Staff \new Voice <<
    \musI
    \musII
  >>
}

What i would like to do is to split \divided function into two
commands \dividedBegin and \dividedEnd, so that the same result would
be produced with an interface like this:

musII = \relative f' {
  e4 g f g
  \dividedBegin
  f2 f
  \dividedEnd
}

(musI and \score block remain the same)

Is this doable at all?  I don't have any good idea on how to do
something like this...

Why i want this?  With current code, i must respect expression nesting
(i.e. everything inside \divided has to be in one expression).  I'd
like to be able to write something like this:

musIIpartI = \relative f' {
  e4 g f g
  \dividedBegin
  f2
}
musIIpartII = \relative f' {
  f2
  \dividedEnd
}
musII = { \musIIpartI \musIIpartII }

best,
Janek



reply via email to

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