lilypond-user
[Top][All Lists]
Advanced

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

Re: need to generate mass quantities of random notes for practice


From: Rune Zedeler
Subject: Re: need to generate mass quantities of random notes for practice
Date: Mon, 04 Jun 2007 05:37:04 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20070306)

plasmacarwash wrote:

I'm a newbie and I'd like to create a blithe score of quarter notes purely
for practice from middle c up an octave and half to g.

This .ly outputs 256 random notes.
It will produce the same 256 random notes each time you run it, but you can create 256 new random notes by simply replacing the randomish number at the top of the file with another.


\version "2.10.0"
\score {
{ #(let ((random-state (seed->random-state 1674234)))
    (ly:export
     (make-music 'SequentialMusic 'elements
      (map (lambda x
            (let ((idx (random 12 random-state)))
             (make-music 'EventChord
              'elements (list (make-music 'NoteEvent
                               'duration (ly:make-duration 2 0 1 1)
                               'pitch (ly:make-pitch (quotient idx 7)
                                       (remainder idx 7)
                                       0))))))
       (make-list 256)))))
}
}




reply via email to

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