[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Macros to enter repeated patterns
From: |
joe ferguson |
Subject: |
Macros to enter repeated patterns |
Date: |
Sun, 30 Jan 2005 16:03:24 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 |
I'm trying to come up with a way to enter repeated patterns of notes and
chords into a score by defining a pattern in one place and then invoking
it in multiple places by naminf the pattern. After struggling with the
problem for a while (it seems like a reasonable thing to want to do,
particularly given my programming background), I decided to try a simple
test case based on two measures of "Twinkle, Twinkle."
This is the score for "Twinkle, Twinkle" that works OK:
\header {
title = " Twinkle "
composer = " Trad. "
}
melody = \notes \relative c' \context Voice = singer {
c4 c g' g | a a g2
}
firstVerse = \lyrics {
\set stanza = "1."
% TEXT
Twi -- kle twin -- kle | lit -- tle star,
}
% More Verses similar
pianoRH = \notes \relative c' {
c4 c g' g | a a g2 |
}
pianoLH = \notes \relative c' {
\clef bass g4 g c c | b b c2 |
}
\score { <<
% \key c \major
\new Staff <<
\melody >>
\lyricsto "singer" \new Lyrics \firstVerse
% MORE VERSES
\new PianoStaff <<
\set PianoStaff.instrument = \markup {
\bold
\bigger\bigger\bigger\bigger \huge "Piano " }
\new Staff \pianoRH
\new Staff \pianoLH
>>
>>
}
------------------------------------------------
This is the attempt using a pattern substitution of "PatAA" for a couple of a's:
\header {
title = " Twinkle "
composer = " Trad. "
}
PatAA = { a a }
melody = \notes \relative c' \context Voice = singer {
c4 c g' g | \PatAA g2
}
firstVerse = \lyrics {
\set stanza = "1."
% TEXT
Twi -- kle twin -- kle | lit -- tle star,
}
% More Verses similar
pianoRH = \notes \relative c' {
c4 c g' g | \PatAA g2 |
}
pianoLH = \notes \relative c' {
\clef bass g4 g c c | b b c2 |
}
\score { <<
% \key c \major
\new Staff <<
\melody >>
\lyricsto "singer" \new Lyrics \firstVerse
% MORE VERSES
\new PianoStaff <<
\set PianoStaff.instrument = \markup {
\bold
\bigger\bigger\bigger\bigger \huge "Piano " }
\new Staff \pianoRH
\new Staff \pianoLH
>>
>>
}
--
Joe Ferguson
- Macros to enter repeated patterns,
joe ferguson <=