Hi Phil,
Below is a modified snippet showing some things I would do in your situation.
(Note there are other ways of accomplishing the same things!)
1. I’ve defined custom contexts: a MySambaStaff context for shared
characteristics, and individual contexts (TamborinStaff, PulseStaff, BothStaff)
for characteristics specific to each type of staff. This allows easier code
maintenance and reuse, and (IMO) makes the code a lot easier to read.
2. I used a GrandStaff to get the span barlines.
3. I tried using \partCombine for the BothStaff music, but it threw an error.
Don’t have time to chase it down, but that’s almost certainly what you’ll
want/need to use here, in order to have notes and rests “merged” correctly.
Hope this helps!
Kieren.
%%% SNIPPET BEGINS
\version "2.19.21"
#(ly:set-option 'point-and-click #f)
#(set-global-staff-size 24)
\header {
title = "Bass and Tam"
}
tamborim_notes = \drummode {
cb r cb r
cb r cb r
r cb r cb
cb r r r
}
tamborim_words = \lyricmode {
one two
three four
one "2"
"3"
}
pulse_notes = \drummode {
r r r r
bd r r r
r r r r
bd r r r
}
pulse_words = \lyricmode {
}
#(define mysamba
'(
(cowbell default #f 0)
(bassdrum default #f -1)
)
)
\layout {
ragged-right = ##f
indent = 1\in
\context {
\DrumStaff
\name MySambaStaff
\consists Pitch_squash_engraver
drumStyleTable = #(alist->hash-table mysamba)
\hide Stem
\override Rest.font-size = #-2
}
\context {
\MySambaStaff
\name TamborimStaff
instrumentName = "Tamborim"
\override StaffSymbol.line-count = #1
\override StaffSymbol.line-positions = #'( 0 )
\override StaffSymbol.staff-space = #1
\override Rest.staff-position = #0
}
\context {
\MySambaStaff
\name PulseStaff
instrumentName = "Pulse"
\override StaffSymbol.line-count = #1
\override StaffSymbol.line-positions = #'( -1 )
\override StaffSymbol.staff-space = #1
\override Clef.Y-offset = #-0.5
\override Rest.staff-position = #-1
}
\context {
\MySambaStaff
\name BothStaff
\consists Merge_rests_engraver
instrumentName = "Both"
\override InstrumentName.padding = #0.4
\override StaffSymbol.line-count = #2
\override StaffSymbol.line-positions = #'( 0 -1 )
\override StaffSymbol.staff-space = #3
\override NoteColumn.force-hshift = #0
\override Rest.staff-position = #-0.5
}
\context {
\GrandStaff
\remove System_start_delimiter_engraver
\accepts TamborimStaff
\accepts PulseStaff
\accepts BothStaff
\omit TimeSignature
\override InstrumentName.padding = #1
\override InstrumentName.self-alignment-X = #RIGHT
}
}
\score {
\new GrandStaff <<
\new TamborimStaff {
\repeat volta 3
\new DrumVoice { \voiceOne \tamborim_notes }
\addlyrics \tamborim_words
}
\new BothStaff {
\repeat volta 3
<<
\new DrumVoice { \voiceOne \pulse_notes }
\\
\new DrumVoice { \voiceTwo \tamborim_notes }
>>
}
\new PulseStaff {
\repeat volta 3
\new DrumVoice { \voiceOne \pulse_notes }
\addlyrics \pulse_words
}
>>
}
%%% SNIPPET ENDS
> On Nov 23, 2024, at 2:37 PM, Philip Harris via LilyPond user discussion
> <[email protected]> wrote:
>
> Hi
>
> I'm trying to create a teaching page for samba "grooves" for non-music
> readers !!
>
> Each groove is typically about 4 measures long and each instrument plays up
> to 4 notes per measure (the tune is made up from multiple repetitions of
> these grooves!)
>
> I want to use the same note definitions in multiple scores in the .ly file so
> I can have each instrument separately (possibly with a mnemonic)
>
> and also together on one stave - so you can more easily see where the the
> notes are played in relation to the other instruments - I hope my attached
> .pdf file gives an insight
>
> I have created quite a big example as I am still learning!
>
> In it I use bassdrum (bd) for my "pulse" and cowbell (cb) for the tamborim -
> as I cannot find these actual instruments in the midi voices
>
> Of the back of my example I have a few questions...
>
> 1) how do I define a set of notes for each of two instruments such that I can
> use them alone and with eachother (I don't want to see rests and notes on the
> same vertical line)
>
> 2) How do I make the rests smaller (#'mensural does not seem to work)
>
> 3) How do I extend the bar lines so they span all the scores (like the
> initial one does!)
>
> 4) Do I have to use other instruments to simulate samba instruments (it would
> be nice to be able to generate midi and play the combined and individual parts
>
> I have other questions - but I suspect I might be going about this in the
> wrong way - so feel free to point out how I might want to do this "properly"
> :-)
>
> Thanks
>
> Phil
> <bd-cb-example.ly><bd-cb-example.pdf>
______________________________________________
My work day may look different than your work day. Please do not feel obligated
to read or respond to this email outside of your normal working hours.