lilypond-user
[Top][All Lists]
Advanced

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

Re: Tags for contexts without duration


From: Valentin Petzel
Subject: Re: Tags for contexts without duration
Date: Fri, 15 Apr 2022 13:02:03 +0200

Chaire Demetrios!

tags work by assigning a special tag attribute to a music event and can 
therefore be applied to any music event by the syntax \tag tag music. But in 
my opinion tags are not always the best method to achieve such things, 
especially should you ever want to have something like multiple cases 
depending on the edition. So if you want to do more complex stuff it is 
feasible to use music functions as some sort of parametrized music, somewhat 
like this:

condTweak =
#(define-music-function (cond prop value music)
   (scheme? key-list-or-symbol? scheme? ly:music?)
   (if cond
       (tweak prop value music)
       music))

global =
#(define-music-function (edition) (symbol?)
   #{
     \condTweak #(memq edition '(strings-part brass-part))
                Y-offset #(assoc-ref '((strings-part . 8) (brass-part . 16)) 
edition)
     \tempo "Allegro"
     s1
   #})

v = { c''1 }

<<
  \new Devnull \global full-score
  \new Staff \v
>>

<<
  \new Devnull \global strings-part
  \new Staff \v
>>

<<
  \new Devnull \global brass-part
  \new Staff \v
>>

Cheers,
Valentin

Am Freitag, 15. April 2022, 11:09:20 CEST schrieb Dimitris Marinakis:
> Oh wow I can't believe I missed this use of tags. I was trying to use the
> bracket syntax. Thanks Jean!
> 
> On Fri, Apr 15, 2022 at 12:43 AM Jean Abou Samra <jean@abou-samra.fr> wrote:
> > Le 14/04/2022 à 22:44, Dimitris Marinakis a écrit :
> > > I often find myself in need of offsetting some tempo or rehearsal
> > > marks for certain parts but not the full score but tags won't work in
> > > this case since I can't have two marks at the same location on a
> > > single context.
> > 
> > Not sure I understand the problem?
> > 
> > \version "2.22.2"
> > 
> > mus = {
> > 
> >    \tag #'part \once \override Score.RehearsalMark.X-offset = 8
> >    \mark \default
> >    c'
> > 
> > }
> > 
> > % Conductor
> > \removeWithTag #'part \mus
> > 
> > % Parts
> > { \mus }
> > 
> > 
> > Best,
> > Jean

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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