]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/generating-random-notes.ly
Merge branch 'translation' into staging
[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.40"
8
9 \header {
10   lsrtags = "pitches, scheme-language, really-cool"
11
12 %% Translation of GIT committish: b482c3e5b56c3841a88d957e0ca12964bd3e64fa
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 %% Translation of GIT committish: 57f9346bb030f49336a858fcbf1519366fe56454
25   texidocfr = "
26 Le fragment de code Scheme ci-dessous génère aléatoirement 24 notes
27 (ou autant que nécessaire), à partir de l'heure courante (ou un nombre
28 quelconque donné en argument, afin d'obtenir toujours les mêmes notes
29 aléatoires).  Pour obtenir une autre série de notes, il suffit de
30 changer ce nombre.
31
32 "
33   doctitlefr = "Génération de notes aléatoires"
34
35   texidoc = "
36 This Scheme-based snippet generates 24 random notes (or as many as
37 required), based on the current time (or any randomish number specified
38 instead, in order to obtain the same random notes each time): i.e., to
39 get different random note patterns, just change this number.
40
41 "
42   doctitle = "Generating random notes"
43 } % begin verbatim
44
45
46 \score {
47   {
48     $(let ((random-state (seed->random-state (current-time))))
49        (make-sequential-music
50          (map (lambda (x)
51                 (let ((idx (random 12 random-state)))
52                   (make-event-chord
53                    (list
54                     (make-music 'NoteEvent
55                                 'duration (ly:make-duration 2 0 1 1)
56                                 'pitch (ly:make-pitch
57                                         (quotient idx 7)
58                                         (remainder idx 7)
59                                         0))))))
60               (make-list 24))))
61   }
62 }