lilypond-user
[Top][All Lists]
Advanced

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

Re: Has anyone extended \include?


From: Rick Hansen (aka RickH)
Subject: Re: Has anyone extended \include?
Date: Wed, 27 Dec 2006 12:31:28 -0800 (PST)



Eduardo Vieira-3 wrote:
> 
> Citando "Rick Hansen (aka RickH)" <address@hidden>:
> 
>>
>>
>> If you have done this can you share it or sell it to me?  (please dont
>> suggest m4, I gave up on that monster)
>>
>> Thanks
>>
> 
> Hi, Rick! Yes, this preprocessor looks scary, as well as some advanced
> programming with Scheme. But once I got into reading about the GEMA
> preprocessor and didn't look as complicated as m4. Maybe it's worth a try.
> Another thing I found out that is *really* useful with text editing,
> manipulating: Learn Regular Expressions. You can do quite a few tricky
> search
> and replace tasks. And most of text editors for programmers support them.
> 
> Eduardo
> ___________________________________________________________________________________
> Neste Fim de Ano, interurbano para cidades próximas ou distantes é com o 
> 21.
> A Embratel tem tarifas muito baratas de presente para você ligar para quem
> você gosta e economizar. Faz um 21 e aproveite.
> 
> 
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/lilypond-user
> 
> 


Thanks Eduardo,

I am liking the GEMA pre-processor, here is how I implememnted snippet
libraries of "canned" lilypond code that can be "macroized" and for
inclusion in lilypond source.



SAMPLE chord library GEMA definition (the macro parameters are root,
chordname, duration with a period delimiter):

GEMA_Chord * * *.=\\transpose c $1 \{ \\relative \{\
\
@cmpi{$2;Maj7;; <c e g b>;}\
@cmpi{$2;Maj7_1;; <c\5 g' b e>;}\
@cmpi{$2;6;; <c e g a>;}\
! etc, etc, etc...\
\
$3 \} \};



SAMPLE of what the lilypond source would look like prior to GEMA resolution:

GEMA_Chord c Maj7 4.
GEMA_Chord c 6 4.



SAMPLE of what GEMA resolves (output to be compiled by lilypond):

\transpose c c { \relative { <c e g b>4 } }
\transpose c c { \relative { <c e g a>4 } }



This is much easier than scheme music functions for generating lp source
code.  GEMA was pretty easy to figure out how to use by a non-programmer
(like me), in about 2 hours time I was able to make the above chord library
macro.  I only have to now change my build scripts to run GEMA ahead of
lilypond.  To keep my LP code cleaner I'm prefixing all my future macros
with "GEMA_".

In my sample above the @cmpi functions act like a big CASE statement to
output the desired music based on the second parameter (chord name).  The
first parameter (the chord root) is appended to a \transpose statement.  The
last parameter (the duration) is appended behind the generated notes.  In my
chord library I only need to state each chord inversion once (with roots of
c).  I expect the library to have a thousand different inversions eventually
so this will help in future productivity in generating chords for all
purposes.

Thanks again
Rick




-- 
View this message in context: 
http://www.nabble.com/Has-anyone-extended-%5Cinclude--tf2871492.html#a8067102
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.





reply via email to

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