lilypond-user
[Top][All Lists]
Advanced

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

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


From: Stefano Antonelli
Subject: Replace the notes in a phrase (drum notation) with scheme?
Date: Sun, 26 Apr 2020 14:05:53 -0700

Hello list,

This might be a tall ask, but is there any way to take a complicated
music expression and after it's fully evaluated replace a note?

It's very typical to have a drum groove that lasts for many bars, but
the very first bar starts with a crash cymbal.  What I would like to do
is replace this expression:

\groovec \repeat unfold 3 {\groove}

with something along the lines of:

(#crash-on-first-beat {\repeat unfold 4 {\groove}})

Drum notation is a bit complicated and I've probably made it even more
complicated with the way I enter phrases:

groove = \drummode {
        <<
        \voiceOne { \repeat unfold 8 {hh8}}
        \\
        \voiceOne { s4 sn4 s4 sn4 }
        \\
        \voiceTwo { bd8 bd8 r4 bd8 bd8 bd8 bd8 }
        >>
}

Attached is a minimal working groove.

My first thought was to use a simple find and replace.  So find the
first hh8 occurrence and replace with cymc8.  Or maybe even find the
3rd occurrence of hh8 and replace with cymc8.  Is that possible with
music expressions?

It would be nice to, perhaps, replace across a bar line too.  Say with
a hi hat open/close.  In this case, it would be looking for two
consecutive hh8s and replace with hho8 and hhc8.

Thanks,
Stef


Attachment: test-a-groove3.ly
Description: Text Data


reply via email to

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