Thanks. That mostly works. Where I'm having an issue now is with
relative pitch.
Here is a sample along with what I notice with the display.
\version "2.26.0" \language "english" par = #(define-music-function
(note) (ly:music?) #{ \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} } } \void \displayLilyMusic \keepWithTag #'piano
{\music} \void \displayLilyMusic \keepWithTag #'guitar {\music}
It seems that the octave is getting confused in both cases.
{ \absolute {
r8 b16 cs'16 gs'4 b16 cs'16 gs'8 { \tag #'piano {cs'8 } } < a, cs e >8 ~ |
} }
{ \absolute {
r8 b16 cs'16 gs'4 b16 cs'16 gs'8 { \tag #'guitar { \tweak parenthesized
##tcs8 } } < a, cs e >8 ~ |
} }
On 7/4/26 12:28 AM, Thomas Morley wrote:
Am Sa., 4. Juli 2026 um 07:50 Uhr schrieb Walt North<[email protected]>:
I have a case where I need to put parenthesis around some notes (not all notes)
for a given instrument to emphasize a specific thing at certain points.
I thought this might be a case where tags would come in handy.
But the following doesn't add the parenthesis. What am I missing? Is the
problem related to having tags within a function? Or would there be a better
way to do this.
\version "2.26.0"
par = #(define-music-function (note) (ly:music?)
#{
\tag #'(piano) { #note }
\tag #'(guitar) { \parenthesize #note }
#})
music = {c'1}
\score {
{
\keepWithTag #'piano {\par \music}
}
}
\score {
{
\keepWithTag #'guitar {\par \music}
}
}
Two issues:
a)
\parenthesize works on a single note or event-chord.
Your `music` is sequential music, though.
Thus { \parenthesize { c'1 } } does not work.
b)
In the function you do #note. This _changes_ `note` for all instances
of the function.
Use a copy instead, i.e. $note
As long as you only want to parenthesize single notes below works here:
par = #(define-music-function (note) (ly:music?)
#{
\tag #'(piano) { $note }
\tag #'(guitar) { \parenthesize $note }
#})
music = c'1
\score {
{
\keepWithTag #'piano {\par \music}
}
}
\score {
{
\keepWithTag #'guitar {\par \music}
}
}
Cheers,
Harm