]> git.donarmstrong.com Git - lilypond.git/blob - input/lsr/generating-random-notes.ly
Merge master into nested-bookparts
[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 \version "2.11.62"
4
5 \header {
6   lsrtags = "pitches"
7
8   texidoces = "
9 Este fragmento de código basado en Scheme genera
10 24 notas aleatorias (o tantas como se necesiten), basándose en la
11 hora actual (o en cualquier número pseudo-aleatorio que se
12 especifique en su lugar, para obtener las mismas notas aleatorias
13 cada vez): es decir, para obtener distintos patrones de notas,
14 sólo tiene que modificar este número.
15
16 "
17   doctitlees = "Generación de notas aleatorias"
18
19   texidoc = "
20 This Scheme-based snippet generates 24 random notes (or as many as
21 required), based on the current time (or any randomish number specified
22 instead, in order to obtain the same random notes each time): i.e., to
23 get different random note patterns, just change this number.
24
25 "
26   doctitle = "Generating random notes"
27 } % begin verbatim
28 \score {
29   { #(let ((random-state (seed->random-state (current-time))))
30     (ly:export
31      (make-music 'SequentialMusic 'elements
32       (map (lambda x
33            (let ((idx (random 12 random-state)))
34             (make-music 'EventChord
35              'elements (list (make-music 'NoteEvent
36                               'duration (ly:make-duration 2 0 1 1)
37                               'pitch (ly:make-pitch (quotient idx 7)
38                                       (remainder idx 7)
39                                       0))))))
40        (make-list 24)))))
41   }
42 }