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