Hi Michael,

On Sun, 2024-08-18 at 11:02 +0200, Zlobinsky Michael wrote:

> Since I only want the drums to sound in the background (so that the
> student has an orientation for syncopated rhythms), it is not so
> dramatic.
> 
> I will try to create more examples for non-drummers over time.

There was a gentleman by the name of Vaylor Trucks who put together a
blog called The Lilypond Cookbook.  It contained some important
snippets to get drum notation to look like it should.  Unfortunately
the landing page at <http://lilypondcookbook.com> is no longer working.

You can access the content here:

<http://web.archive.org/web/20201111224331/http://lilypondcookbook.com/
>

except the page links don't work.  Thankfully all the content is on one
page and if you start from the bottom you can see all the bits of drum
notation as it's developed in order.

There is a blog post with a template that contains all those snippets
together.  I've attached it to this email.

For your purposes, it's probably better to use all stems up.  Rather
than both up and down stems.  It's easier to see all the rhythms.

> 
> https://de-m-wikiversity-org.translate.goog/wiki/Kurs:Lilypond_f%C3%BCr_Wikis:_Schlagzeug?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=de&_x_tr_pto=wapp
> 

I had a quick look at your wiki and noticed that you had issues with
the bass drum not showing up in midi.  I'm using version 2.20.0 also
and don't have a problem with the bass drum showing up in midi.  I'm on
linux and use timidity to play the midi file.

I tried to copy the lilypond code for the first example on your wiki,
but I had to hand edit some stuff.  I suggest you add a way to easily
copy/paste the lilypond code from your wiki.  Your score plugin is
removing the leading \ from all the lilypond commands and if I edit the
page to get the raw text there is embedded html syntax.  Not user
friendly at all.

Then when I compiled that file, the hihats were failing the bar line
check.  I left that alone and changed the floor tom to bass drum and
the midi worked fine for me.  Just to clarify that it's not a lilypond
bug.

When compiling I see:

Interpreting music...
warning: MIDI channel wrapped around
warning: remapping modulo 16

repeated several times.  So something you're doing isn't right.

I think it's because

myDrum = { \new DrumStaff <<

and 

\unfoldRepeats \repeat volta 32 { \myDrum }

That DrumStaff should probably be outside the repeat.  So if I replace:

myDrum = {  \new DrumStaff <<

with

myDrum = { <<

With other adjustments adding \new DrumStaff where it needs to be, that
fixes the two drum stave problem, but not the midi warnings.

The fix for the midi problem was to move the \new DrumVoice out of the
repeat.  This then required a \\ to combine the two voices.

myDrum = { <<
      \drummode { \voiceOne \repeat volta 8 {\up}}
  \\
      \drummode { \voiceTwo \repeat volta 8 {\down}}
  >>
}

then the midi score changes from:

\unfoldRepeats \repeat volta 32 { \myDrum }

to:

\new DrumVoice  \unfoldRepeats \repeat volta 32 { \myDrum }

And as far as I can tell it generates all the right outputs.  You can
also move the \unfoldRepeats up into the score context and I made some
other changes that make some of the syntax more explicit.  This is the
modified score block for midi output:

\score {
  \unfoldRepeats
  <<
    \new Staff \with { midiInstrument = #"acoustic guitar (nylon)" }
      \myKey
      \new Voice
        \repeat volta 16 { \myGuitar }
        < d a-1 d'-3 fis'-2>1 % D (End)
  \\
    \new DrumStaff
      \new DrumVoice
        \repeat volta 32 { \myDrum }
  >>
  \midi{}
}

But I don't claim to be an expert at lilypond syntax.  I just find with
drum stuff I have to be explicit, so I treated the guitar voice the
same as the drum voice.  I don't know if it's the correct way to do it.

Refer to the attached test.ly.

-Stef

\version "2.18.0"

% ====== Drum notations customized
#(define md '(
  (ridecymbal   cross    #f  5)(ridebell     xcircle  #f  5)
  (crashcymbal  cross    #f  6)(splashcymbal harmonic #f  6)
  (pedalhihat   cross    #f -5)(hihat        cross    #f  5)
  (snare        default  #f  1)(sidestick    cross    #f  1)
  (lowmidtom    default  #f  0)(lowtom       default  #f -1)
  (hightom      default  #f  3)(bassdrum     default  #f -3)
))

% ====== Custom open and half-open ornamentation
pth = #'((moveto 1 0.4) (lineto 0 -0.4))
hop = \markup{\hspace #0.5 \draw-circle #.4 #0.1 ##f}
hhop = \markup{ \combine \hop \path #0.1 #pth }
act = \markup {\left-align \musicglyph #"scripts.sforzato"}

% ===== Stems Up voice
up = \drummode { 
  % Customizations
  \stemUp
  \slurDown
  \numericTimeSignature
  
  % Tempo and rehearsal marks
  \mark #1
  
  % Notes
  
  \bar ":|."
}

% ===== Stems Down voice
down = \drummode { 
  % Customizations
  \stemDown
  
  % Notes
  
}

% ====== Layout customizations
\score
{
  <<
    \set Score.markFormatter = #format-mark-circle-numbers
    \override Score.RehearsalMark #'X-offset = #0.5
    \new DrumStaff
    <<
      \set DrumStaff.drumStyleTable=#(alist->hash-table md)
      \new DrumVoice {\voiceOne \up}
      \new DrumVoice {\voiceTwo \down}
    >>
  >>
  
  \layout {\context {\Score \remove "Bar_number_engraver"}}
}

% ===== Page customizations
\paper{
  #(set-paper-size "letter")
  indent=#0
  line-width=#200
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  bookTitleMarkup = ##f
  scoreTitleMarkup = ##f
}
\version "2.20.0"
\header {
  title="Pop-Formel in D"
  subtitle="Rhythmus BB-B5"
  encoder="mjchael"
}
myKey = {
  \tempo 4 = 100
  \time 4/4
  \key d \major
}
%% Gitarre Midi
myD = { < d a d' fis'>4 8 8 4 8 8 }
myA = { < a, e a cis' e'>4 8 4 8 4 }
myBm = { < b, fis b d' fis'>4 8 8 4 8 8 }
myG = { < g, d g b d' g'>4 8 4 8 4 }

myGuitar = {
  \repeat volta 4 { 
  \myD \myA \myBm \myG }
}

%% Drum Background 
up = \drummode {
  hh8 8 8 8 halfopenhihat  openhihat hh8 8 |
  hh8 8 8 8 halfopenhihat  openhihat hh8 8 |
}
down = \drummode {
  <bd snare>4 sn bd sn |
  <bd snare>4 sn bd sn |
}
myDrum = { <<
      \drummode { \voiceOne \repeat volta 8 {\up}}
  \\
      \drummode { \voiceTwo \repeat volta 8 {\down}}
  >>
}

\score {
<<
  %% Fretboard with chord names 
  \new ChordNames { \chordmode {
    d1 a b:m g
  }}
  \new FretBoards {
    \override FretBoards.FretBoard.size = #'1.5
    \override FretBoard.fret-diagram-details.finger-code = #'in-dot
    \override FretBoard.fret-diagram-details.dot-color = #'white
    \override FretBoard.fret-diagram-details.orientation =
        #'landscape
 < d a-1 d'-3 fis'-2> % D
 < a, e-1 a-2 cis'-3 e'  > % A
 < b,-1 fis-3 b-4 d'-2 fis'-1>1 % Bm
 < g,-1 d-3 g-4 b-2 d'-1 g'-1> % G
  }
 >>
}
%% Strumming Pattern
\score {
 \new Voice \with {
    \consists "Pitch_squash_engraver"
  }{
    \set Staff.midiInstrument = "acoustic guitar (nylon)"
    \improvisationOn
    \override NoteHead.X-offset = 0
    \repeat volta2 {
    d4 \downbow % 1
    d8 \downbow % 2
    d8   \upbow % +
    d4 \downbow % 3
    d8 \downbow % 4
    d8   \upbow % +
    d4 \downbow % 1
    d8 \downbow % 2
    d4   \upbow % + (3)
    d8   \upbow % +
    d4 \downbow % 4
    }
  }\addlyrics {"1" "2" "+" "3" "4" "+" "1" "2" "+" "+" "4" }
  \layout{} 
}
%% Drum Background remove the space between % { to hide them 
% { Check 
 \score { \new DrumStaff \with {
    drumStyleTable = #agostini-drums-style
  }{ \new DrumVoice \myDrum }}
%}


%% This score block is for midi output only
\score {
	<<
		\myKey
		\set Staff.midiInstrument = #"acoustic guitar (nylon)"
		\unfoldRepeats \repeat volta 16
			{ \myGuitar }
			< d a-1 d'-3 fis'-2>1 % D (End)
		\new DrumVoice	\unfoldRepeats \repeat volta 32 { \myDrum }
	>>
	\midi{}
}

\paper {
  indent=0\mm
  line-width=80\mm
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  % bookTitleMarkup=##f
  scoreTitleMarkup=##f
}

Reply via email to