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