On 1/16/2026 11:59 PM, Jeff Olson wrote:
It seems that \harmonicByFret won't take any other numbers but the
ones that are hard-coded into tablature.scm:
(define node-positions
(vector 12
7 19
5 12 24
4 9 16 28
3 7 12 19 31
2.7 5.8 9.7 14.7 21.7 33.7
2.3 5 8 12 17 24 36
2 4.4 7 10 14 19 26 38 ))
I tried copying this scheme into my MWE (with a leading #) and
changing the 3 to 3.2 but it had no effect.
Can someone show me how to modify my MWE so that it shows fret (3.2)
for harmonic #1/6?
Hope some kind soul can still help me modify node-positions (or
whatever) so I can use my own decimals with harmonicByRatio.
But in the mean time, there is an ugly workaround using tags that would
be prettier if Lilypond syntax will allow.
Here's the ugly workaround. Since \harmonicByFret #3.2 works in the
TabStaff (right decimal fret) and \harmonicByRatio #1/6 works in the
Staff (right note), the music can be tagged like this to have it either way:
\tag #'bydec { \harmonicByFret #3.2 e,\6 }
\tag #'byrat { \harmonicByRatio #1/6 e,\6 }
while the score chooses one for the Staff and the other for TabStaff.
The full working example is in the attached MWE-harmonics.ly.
Here's where I need some Lilypond syntax help with tags and \etc.
Can those two tag lines defining alternative harmonics on the note e,\6
be written as one variable that hides all the tag and harmonic
complexities? For example could those two tag lines be reduced to the
following line:
\harmTag e,\6
To keep the music cleaner I already use such a variable defined with
\etc to abbreviate which particular harmonic rule is being applied.
Here is what I hoped would work for defining harmTag (code is also in
the MWE, commented out):
harmByRat = \harmonicByRatio #1/6 \etc
harmByDec = \harmonicByFret #3.2 \etc
harmTag = { \tag #'byrat { \harmByRat } \tag #'bydec {
\harmByDec } }
But it fails with:
M:/music/lilypond/MWE-harmonics.ly:6:39: error: syntax error, unexpected
'}', expecting \header
harmTag = { \tag #'byrat { \harmByRat
} \tag #'bydec {
\harmByDec } }
Why is it expecting \header? And is something like \harmTag even possible?
TIA,
Jeff
\version "2.24.3"
%harmByRat = \harmonicByRatio #1/6 \etc
%harmByDec = \harmonicByFret #3.2 \etc
%harmTag = { \tag #'byrat { \harmByRat } \tag #'bydec { \harmByDec } }
openStringHarmonics = {
\textSpannerDown
\override TextSpanner.staff-padding = #3
\override TextSpanner.dash-fraction = #0.3
\override TextSpanner.dash-period = #1
%fifth harmonic
\override TextSpanner.bound-details.left.text =
%\markup\small "5th harm. "
\markup\small "harm #1/6 "
\harmonicByFret #3 e,4\6\startTextSpan
\tag #'bydec { \harmonicByFret #3.2 e,\6 }
\tag #'byrat { \harmonicByRatio #1/6 e,\6 }
% \harmTag e,\6
\harmonicByRatio #1/6 e,2\6\stopTextSpan
%sixth harmonic
\override TextSpanner.bound-details.left.text =
%\markup\small "6th harm. "
\markup\small "harm #1/7 "
\harmonicByFret #2.7 e,4\6\startTextSpan
\harmonicByFret #2.8 e,\6 % gives wrong note
\harmonicByRatio #1/7 e,2\6\stopTextSpan
}
\score {
<<
\new Staff
\with { \omit StringNumber } {
\new Voice {
\clef "treble_8"
\keepWithTag #'byrat \openStringHarmonics
}
}
\new TabStaff {
\new TabVoice {
\keepWithTag #'bydec \openStringHarmonics
}
}
>>
}