modaltranspose & scheme function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

modaltranspose & scheme function

Gianmaria Lari
Long time ago with the help of the people in this forum I have been able to write (to collect) this simple code

\version "2.19.82"
\include "changePitch.ly"

multiModal =
#(define-music-function (scale patternRhytmic patternMelodic) (ly:music? ly:music? ly:music?)
   #{
     #@(map(lambda (p)
     #{ \changePitch $patternRhytmic \modalTranspose c #(ly:make-pitch -1 p) $scale $patternMelodic #})
     (iota 8))
   #})

scalex = \fixed c' {c d e f g a b}
{ \multiModal \scalex {4 8 8} {c' d' e'} }

generating this:

c4 d8 e
d4 e8 f
e4 f8 g
etc.

I would like to modify it so that the generated output would be:

c4 d8 e
b'4 c8 d
a'4 b'8 c
etc.

Any help?
Thank you, g.


Annotation 2020-03-19 121413.jpg (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: modaltranspose & scheme function

Aaron Hill
On 2020-03-19 4:20 am, Gianmaria Lari wrote:

> multiModal =
> #(define-music-function (scale patternRhytmic patternMelodic)
> (ly:music?
> ly:music? ly:music?)
>    #{
>      #@(map(lambda (p)
>      #{ \changePitch $patternRhytmic \modalTranspose c #(ly:make-pitch
> -1
> p) $scale $patternMelodic #})
>      (iota 8))
>    #})

> I would like to modify it so that the generated output would be:
>
> c4 d8 e
> b'4 c8 d
> a'4 b'8 c

(iota 8) produces (0 1 2 3 4 5 6 7).
(iota 8 0 -1) would produce (0 -1 -2 -3 -4 -5 -6 -7).


-- Aaron Hill

Reply | Threaded
Open this post in threaded view
|

Re: modaltranspose & scheme function

Gianmaria Lari


(iota 8) produces (0 1 2 3 4 5 6 7).
(iota 8 0 -1) would produce (0 -1 -2 -3 -4 -5 -6 -7).

oh, great! Thanks Aaron!
g.