]> git.donarmstrong.com Git - lilypond.git/blob - input/lsr/scheme/generating-random-notes.ly
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / input / lsr / scheme / generating-random-notes.ly
1 %%  Do not edit this file; it is auto-generated from LSR!
2 \version "2.11.23"
3
4 \header { texidoc = "
5 This Scheme-based snippet allows you to generate 256 random notes based
6 on the current time (or any randomish number you might wish to specify
7 instead, so you can obtain the same random notes each time): i.e. to
8 get different random notes patterns, just change this number.
9 " }
10
11 \score {
12 { #(let ((random-state (seed->random-state (current-time))))
13     (ly:export
14      (make-music 'SequentialMusic 'elements
15       (map (lambda x
16            (let ((idx (random 12 random-state)))
17             (make-music 'EventChord
18              'elements (list (make-music 'NoteEvent
19                               'duration (ly:make-duration 2 0 1 1)
20                               'pitch (ly:make-pitch (quotient idx 7)
21                                       (remainder idx 7)
22                                       0))))))
23        (make-list 256)))))
24    }
25 }