lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace the notes in a phrase (drum notation) with scheme?


From: Stefano Antonelli
Subject: Re: Replace the notes in a phrase (drum notation) with scheme?
Date: Mon, 27 Apr 2020 22:59:19 -0700

On Tue, 2020-04-28 at 02:14 +0200, Gilles Thibault wrote:
> > 
> > groove = \drummode {
> >     <<
> >     \voiceOne { \repeat unfold 8 {hh8}}
> >     \\
> >     \voiceOne { s4 sn4 s4 sn4 }
> >     \\
> >     \voiceTwo { bd8 bd8 r4 bd8 bd8 bd8 bd8 }
> >     >>
> > }
> > 
> Hello Stafano.

Salut Gilles, many thanks for the reply.

> Perhaps you can try \multiReplaceMusic, a function from
> extractMusic.ly described here :
> http://lsr.di.unimi.it/LSR/Item?id=542

Quite the coincidence, I came across that snippet and others earlier
today.  That eventually led me to your personal website and from where
I downloaded all the lilypond scripts for further study.

I've been looking at extractMusic.ly trying to understand how it works
from the perspective of a non-scheme programmer.  I was hoping I could
cherry pick some select functions from a few different approaches in
the lsr, but I don't have enough scheme experience to hack it.

> %%%%%%%%%%%%%%%%%%%%%%%
> \include "extractMusic.ly"
> 
> groove = \drummode {
>       <<
>       { \voiceOne \repeat unfold 8 hh8 }
>       \\
>        { \voiceOne s4 sn4 s4 sn4 }
>       \\
>        { \voiceTwo bd8 bd8 r4 bd8 bd8 bd8 bd8 }
>       >>
> }
> 
> groovec = \drummode {
>       <<
>        { \voiceOne cymc8 \repeat unfold 7 hh8 }
>          \\
>        { \voiceOne s4 sn4 s4 sn4 }
>       \\
>        { \voiceTwo bd8 bd8 r4 bd8 bd8 bd8 bd8 }
>       >>
> }
> 
> 
> grooveFinal = \multiReplaceMusic \repeat unfold 16 \groove {
>                  \groovec s1*0
>                  \groovec s1*4
>                  \groovec s1*8
>                  \groovec s1*12 }
> 
> 

I appreciate the suggestion, but I don't think that helps.  I can see
that you are replacing whole bars of music, which is kinda cool in
fact.  However, it doesn't help me with my goal which is to not have to
define groovec at all.

I'm just trying to cut down on some of the duplication when only a
single note change is required.  As a test I tried:

beatc = \drummode {
        <<
        \voiceOne { cymc8 }
        >>
}

\multiReplaceMusic \repeat unfold 16 \groove {
      \beatc s1*0
      \beatc s1*4
      \beatc s1*8
      \beatc s1*12 }

But that removed the bass drum on beat 1 as well.  I guess that's to be
expected.  So then I tried:

beatc = \drummode {
        <<
        \voiceOne { cymc8 }
        \\
        \voiceTwo { bd8 }
        >>
}

This fixed the bass drum on beat1, but removed the beam between the 1st
and 2nd bass drum 8th notes.

Is there a way to limit multiReplaceMusic to a single voice?

Thanks,
Stef




reply via email to

[Prev in Thread] Current Thread [Next in Thread]