]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/generating-random-notes.ly
edef2c824909d5465017105d149d3310931cabd8
[lilypond.git] / Documentation / snippets / generating-random-notes.ly
1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
4 \version "2.13.39"
5
6 \header {
7   lsrtags = "pitches"
8
9 %% Translation of GIT committish: 5160eccb26cee0bfd802d844233e4a8d795a1e94
10   texidoces = "
11 Este fragmento de código basado en Scheme genera
12 24 notas aleatorias (o tantas como se necesiten), basándose en la
13 hora actual (o en cualquier número pseudo-aleatorio que se
14 especifique en su lugar, para obtener las mismas notas aleatorias
15 cada vez): es decir, para obtener distintos patrones de notas,
16 sólo tiene que modificar este número.
17
18 "
19   doctitlees = "Generación de notas aleatorias"
20
21   texidoc = "
22 This Scheme-based snippet generates 24 random notes (or as many as
23 required), based on the current time (or any randomish number specified
24 instead, in order to obtain the same random notes each time): i.e., to
25 get different random note patterns, just change this number.
26
27 "
28   doctitle = "Generating random notes"
29 } % begin verbatim
30
31 \score {
32   {
33     #(let ((random-state (seed->random-state (current-time))))
34        (ly:export
35         (make-sequential-music
36          (map (lambda (x)
37                 (let ((idx (random 12 random-state)))
38                   (make-event-chord
39                    (list
40                     (make-music 'NoteEvent
41                                 'duration (ly:make-duration 2 0 1 1)
42                                 'pitch (ly:make-pitch
43                                         (quotient idx 7)
44                                         (remainder idx 7)
45                                         0))))))
46               (make-list 24)))))
47   }
48 }