[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: substitution function variable name
From: |
Jean Abou Samra |
Subject: |
Re: substitution function variable name |
Date: |
Sun, 22 Jan 2023 18:31:40 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 |
Le 22/01/2023 à 18:22, Darren Ng a écrit :
Thanks. The following works:
accOne =
#(define-music-function
(x )
(ly:pitch?)
#{
$x 8 $x 8
#})
My ultimate goal is a function which does the following
accTwo =
#(define-music-function
(x )
(ly:pitch?)
#{
$x 8 r8
<($x+4) ($x+7)>8 r8
($x-5) 8 r8
<($x+4) ($x+7)>8 r8
#})
E.g.
\accTwo c expands to { c8r8 <eg>8r8 g,8r8 <eg>8r8 }
\accTwo f expands to { f8r8 <ac'>8r8 c8r8 <ac'>8r8 }
What material should I read so that I'll be able to achieve this?
Spoiler: you can do that with just
\version "2.24.0"
accTwo =
#(define-music-function
(x )
(ly:pitch?)
#{
$x 8
r8
<\transpose c e $x \transpose c g $x >8
r8
<\transpose c g, $x >8 r8
<\transpose c e $x \transpose c g $x >8
r8
#})
\accTwo c'
Now, if you still want to learn how you might have done that in Scheme,
try reading
https://extending-lilypond.readthedocs.io/en/latest/music.html#pitches
and you might also want a Scheme tutorial in case you don't already know the
language itself:
https://scheme-book.readthedocs.io/
or
https://tutoriel-scheme.readthedocs.io/
Jean
OpenPGP_signature
Description: OpenPGP digital signature