Re: Notes in staff=invisible while tablature=visible
Michael Werner <[email protected]>
| Newsgroups | gmane.comp.gnu.lilypond.general |
|---|---|
| Message-ID | <[email protected]> |
On 8/8/26 7:24 PM, Djeem Djuheerme wrote:
> I asked copilot for a solution but I want to get away from AI if possible. So I didn't follow up to get tweaks to its two suggestions (one didn't work; one I can't get to compile).
>
> For mountain dulcimer tablature, we normally only show the melody in the staff, even if we are to strum the drones (strings 1 and 2).
> This would keep the staff cleaner; and because of the ledger lines, more vertically compact in a perfect solution.
> Naturally, I would want to see some of the notes, hide others.
When I do lap dulcimer music I don't bother entering the drones. I just
take it as assumed that they'll be played while strumming. If it's a
chord melody piece, on the other hand, then I'll enter whatever chords
are needed.
> \new TabStaff <<
> \override TabStaff.Stem.transparent = ##t
> \override TabStaff.Beam.transparent = ##t
> \override TabStaff.TupletNumber.transparent = ##t
> \override TabStaff.TupletBracket.transparent = ##t
> \override TabStaff.NoteColumn.ignore-collision = ##t
> \override TabStaff.Rest.transparent = ##t
These overrides are actually the defaults for a TabStaff - no need to
add them in here.
Overall I think I'd do things a little different. Something along these
lines:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Replace the clef with the tuning
% Based on version1.ly posted to
% lilypond-user by Tina Petzel
% 29 Jan 2023 in thread
% Override baseline-skip according layout-staff-size
%
#(define-markup-command (par-relative layout props pars arg)
(list? markup?)
#:properties ((font-size 0))
(let* ((layout-text-font-size
(ly:output-def-lookup layout 'text-font-size 11))
(paper-text-font-size
(ly:output-def-lookup
(ly:parser-lookup '$defaultpaper)
'text-font-size 11))
(unit (/ layout-text-font-size paper-text-font-size))
(unit (* unit (magstep font-size)))
(par-vals (map (lambda (par) (chain-assoc-get par props)) pars))
(par-vals-scaled (map (lambda (val) (if (number? val) (* val
unit) val)) par-vals))
(new-props (map cons pars par-vals-scaled))
(new-props (filter (lambda (x) (cdr x)) new-props)))
(interpret-markup layout (cons new-props props) arg)))
DADclef = {
\set Staff.clefPosition = #1
\override Staff.Clef.stencil =
#(lambda (grob)
(grob-interpret-markup grob
#{ \markup {
\override #'((baseline-skip . 1)
(thickness . 1.5) (size . 1.5))
\par-relative #'(baseline-skip size)
\fontsize #-2 \bold
\override #'((style . rounded-box)
(thickness . 1.5))
\whiteout {
\center-column {
D A D }}}#}))
}
\header {
title="Dog Treed a Possum"
composer="trad"
tagline= ##f
}
PAVA = {
\tempo 4 = 120
\time 2/2
\key d \major
\partial 4 fis'8 e' | % 1
d'4 fis' <a' fis'> <d'' fis'> | % 2
}
PAVAChords = {
\partial 4 s4 d1
}
\score {
\new StaffGroup <<
\new ChordNames {
\PAVAChords
}
\new Staff \with {
instrumentName = "md"
} {
\PAVA
}
\new TabStaff \with {
stringTunings = \stringTuning <d a d'>
} {
\new TabVoice {
\DADclef \PAVA
}
}
>>
}
\layout {
\context {
\TabStaff
fretLabels = #'(
"0" "x" "1" "1½" "2" "3" "x" "4" "x" "5"
"6" "6½"
"7" "x" "8" "8½" "9" "10" "x" "11" "x" "12"
"13" "13½"
"14" "x" "15" "15½" "16" "17" "x" "18")
tablatureFormat = #fret-letter-tablature-format
stringOneTopmost = ##f
highStringOne = ##f
}
\context {
\Voice
\override StringNumber.stencil = ##f
}
}
The first 2 blocks of code will put the tuning into the TabStaff in
place of the tab clef, which is a very common practice with dulcimer
music. The TabStaff context in the layout block takes care of flipping
the TabStaff over to put the melody string on the bottom, while keeping
it as string 1 making note entry a little easier and a bit more straight
forward.
This hopefully will be enough to get you started along the way. When I
first started with LilyPond trying to get lap dulcimer music to
cooperate was quite the challenge.
--
Michael