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