On 05/07/2026 18:04, Walt North wrote:
But that leaves the mystery for a later date about using relative with
tags in a function. I have experimented with \resetRelativeOctave but
that seems a bit cumbersome.
When music is written using \relative, converting from relative to
absolute pitch happens before filtering tagged music. So in your example
there are two cs, resulting in the following music being an octave too
low. The solution is to use the rather obscure make-relative macro as
below. The function par should operate correctly with both \relative and
\absolute note entry.
\version "2.26.0"
\language "english"
par = #(define-music-function (note) (ly:music?)
(make-relative (note)
note
#{
\tag #'(piano) { $note }
\tag #'(guitar) { \parenthesize $note }
#}))
music = \relative c' { r8 b16 cs gs'4 b,16 cs gs'8 \par cs,8 <a cs e>~ |}
\score {{
\keepWithTag #'piano {\music}
}}
\score {{
\keepWithTag #'guitar {\music}
}}
--
Timothy Lanfear, Bristol, UK.