Hi,

I'm starting to play with scheme in Lilypond.
I'm adapting a snippet about creating random notes. I'd like to be able to make 
the code more customizable for a non coding user.

So I tried something like this:


random-state = # (seed->random-state (current-time))
randomNote = #(define-music-function
(parser location) ()
        (let ((idx (random 12 random-state)))
                (make-event-chord
                (list
                        (make-music 'NoteEvent
                                                'duration (ly:make-duration 2 0 
1 1)
                                                'pitch (ly:make-pitch
                                                        (quotient idx 7)
                                                        (remainder idx 7)
                                                        0))))))

\score {
        \repeat unfold 24 { $randomNote }
}

I excepted that I wouldn't get what I want :) : $randomNote would be called 
only once a the result copied 24 times (24 identical notes).
Is there a way to force lilypond to evaluate the repeated music each time? 
Should I write my own repeat function? Or is the only way is really to have a 
scheme function returning a list of notes?

Jean-Alexis


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to