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