]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/generating-random-notes.ly
Updates LSR locally
[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.15.18"
8
9 \header {
10   lsrtags = "pitches"
11
12 %% Translation of GIT committish: 8b93de6ce951b7b14bc7818f31019524295b990f
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        (make-sequential-music
38          (map (lambda (x)
39                 (let ((idx (random 12 random-state)))
40                   (make-event-chord
41                    (list
42                     (make-music 'NoteEvent
43                                 'duration (ly:make-duration 2 0 1 1)
44                                 'pitch (ly:make-pitch
45                                         (quotient idx 7)
46                                         (remainder idx 7)
47                                         0))))))
48               (make-list 24))))
49   }
50 }