lilypond-user
[Top][All Lists]
Advanced

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

Re: Fold out repeats with alternatives


From: Jay Anderson
Subject: Re: Fold out repeats with alternatives
Date: Sat, 21 Jul 2012 07:45:54 -0700

On Sat, Jul 21, 2012 at 7:17 AM, Johan Vromans <address@hidden> wrote:
> However, I'd like to avoid the use of variables since that visually
> interrupts the flow of notes.

I don't think there's any way to avoid interrupting the flow. However
you can avoid variables and keep the music inline with what David
wrote, but it's not the cleanest since you need another inner block:
==========================
\version "2.15.41"

\score
{
  \new Staff \relative c'
  {
    c1 |
    \pushToTag #'here \relative c' { b1 }
    {
      d1
      \tag #'here {}
      e1
      \tag #'here {}
      f1
    }
    g1
  }
}
==========================

One thing I've thought about is temporary storage of inline music:

==========================
#(define music-storage '())

storeMusic =
#(define-music-function (parser location sym mus) (symbol? ly:music?)
  (set! music-storage
    (assq-set! music-storage sym mus))
  mus)

fetchMusic =
#(define-music-function (parser location sym) (symbol?)
  (assq-ref music-storage sym))

\score
{
  \new Staff \relative c'
  {
    c1 |
    d |
    \storeMusic #'A \relative c' { b }
    e
    \fetchMusic #'A
    f
    g
  }
}
==========================

Some care would be needed since music-store is never cleaned out
(memory leak), but I think an approach like this could be useful. Also
the inner relative would be required though I'm sure there are ways to
fix that.

-----Jay



reply via email to

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