Gianmaria Lari <[email protected]> writes: > On 20 November 2017 at 23:01, David Kastrup <[email protected]> wrote: >> >> whatever = >> #(define-music-function (pattern) (ly:music?) >> #{ \fixed c' { >> #@(map >> (lambda (p) >> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #}) >> (iota 8)) >> } #}) >> >> \whatever {c d e f} >> \whatever {f e d c} >> \whatever {a c e g} >> > > I tried the above code but without success. When I tried it few days ago I > was thinking there was some simple to solve problem and I didn't write you > immediately; I wanted to try to solve the problem by myself but I have not > been able to do it. > > This is the complete code according what you wrote (I hope I didn't > introduce any errors): > > \version "2.19.80" > scale = {c d e f g a b } > > whatever = > #(define-music-function (pattern) (ly:music?) > #{ \fixed c' { > #@(map > (lambda (p) > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #}) > (iota 8)) > } #}) > > \whatever {c d e f} > \whatever {a c e g} > > > It looks that #(ly:make-pitch -1 p) inside this function does not decrease > the value of p. So the result is always the same _non transposed_ sequence. > There is also a strange (to me) problem with the octave that's too high ( I > have been able to solve it but I don't understand why it happens). > > The same code outside the function works well: > > \fixed c' { > #@(map > (lambda (p) > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #}) > (iota 8)) > } > > > What's the issue?
Sorry, my fault. The result is sky-high pitches. That's typical for "failure to copy": here #pattern is used over and over again and being (destructively) transposed every time. The solution is simply to write $pattern (which _does_ copy, as does \scale) instead of #pattern in the function. -- David Kastrup _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
