Adding to Magnus's answer, I'd recommend for you to use more tags! When I'm
writing a quintet heavy metal piece, using different tags allows me to use
the "same" variable for everyone. Below is code for having two different
guitars play the same notes on different frets without changing the tuning.
Be careful that you must remove (with tags or not writing to the variable)
any mention of TabStaff changes to a normal Staff, because it will create a
random and phantom TabStaff; this is why I wrote three tags - tab (to be
used in TabStaff and to be ignored by a regular Staff), guitarOne (to be
ignored by guitarTwo) and guitarTwo (to be ignored by guitarOne).

%%Code begins
\version "2.24.2"
notes = {
  \tag #'(guitarOne tab) { \set TabStaff.minimumFret = 4 \set
TabStaff.restrainOpenStrings = ##t } % fretting for guitarOne, on a higher
stringer.
  \tag #'(guitarTwo tab) { \set TabStaff.minimumFret = 12 \set
TabStaff.restrainOpenStrings = ##t } % fretting for guitarTwo, on a lower
string.
  a'4 b' c'' b' gis'2 c''4 b' } % end of var notes
guitarOne = { <<
\new Staff {\removeWithTag #'(guitarTwo tab) {\notes}}
\new TabStaff {\removeWithTag #'(guitarTwo) {\notes}}
>> } % end of guitarOne
guitarTwo = { <<
\new Staff {\removeWithTag #'(guitarOne tab) {\notes}}
\new TabStaff {\removeWithTag #'(guitarOne) {\notes}}
>> } % end of guitarTwo
\score { << \guitarOne \guitarTwo >> }
%%Code ends

Best regards,
Lucas

Em qua., 10 de set. de 2025 às 02:14, Walt North <[email protected]>
escreveu:

> My case is that I have some notes that may be played on guitars with
> differing turnings.  To accomplish this I would like to separate the fret
> specifics from the actual notes. What is happening is that only the first
> section of music reflects the fret details for a given tuning.  Following
> is a trimmed down example with just two measures along with result screen
> shots.
>
> \version "2.24.2"
>
> \language "english"
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> bckngNotes = \relative c' {
>   b'1 |
> }
>
> gtrBackingNoteDetails = {
>   \set restrainOpenStrings = ##t
>   \set minimumFret = #12
>   s1 |
> }
>
> verseScore = <<
>   \tag #'gtrBackingNotes \context TabStaff = "gtrBackingNotes"
>   << \bckngNotes \gtrBackingNoteDetails >>
>
> >>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> bckngNotes = \relative c' {
>   b1 |
> }
>
> gtrBackingNoteDetails = {
>   \set restrainOpenStrings = ##t
>   \set minimumFret = #4
>   s1 |
> }
>
> chorusScore = <<
>   \tag #'gtrBackingNotes \context TabStaff = "gtrBackingNotes"
>   << \bckngNotes \gtrBackingNoteDetails >>
>
> >>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> fullScore = {
>   \verseScore
>   \chorusScore
> }
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \book {
>   \score {
>     <<
>       \keepWithTag #'(gtrBackingNotes)
>       \fullScore
>     >>
>   }
> }
>
>
> Here is a screen shot of the result.  What I was hoping for is that the
> second measure would indicate the 4th fret.
>
> fullScore = {
>   \verseScore
>   \chorusScore
> }
>
> If I flip the verse and chorus measures I get and would have wanted the
> second measure to be 12.
>
> fullScore = {
>   \chorusScore
>   \verseScore
> }
>
>
> Walt
>

Reply via email to