%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "snippets/generating-random-notes.ly"
\sourcefileline 0
%% DO NOT EDIT this file manually; it was automatically
%% generated from the LilyPond Snippet Repository
%% (http://lsr.di.unimi.it).
%%
%% Make any changes in the LSR itself, or in
%% `Documentation/snippets/new/`, then run
%% `scripts/auxiliar/makelsr.pl`.
%%
%% This file is in the public domain.

\version "2.23.13"

\header {
%% Translation of GIT committish: a8a85e19654e46d725563e6deba44083ef137a2c
  texidocja = "
この Scheme ベースのスニペットは、24 の (あるいは必要な分の) ランダムな@c
音符を、現在の時間から (あるいは毎回同じ結果を得るために指定した数から)
生成します。別の音符列を生成したい場合は、数字を変更します。
"
  doctitleja = "ランダムな音符を生成する"

%% Translation of GIT committish: a3fd5364fc4f247579da0ed2bfea887ab37285c6
  texidocfr = "
Le fragment de code Scheme ci-dessous génère aléatoirement 24 notes
(ou autant que nécessaire), à partir de l'heure courante (ou un nombre
quelconque donné en argument, afin d'obtenir toujours les mêmes notes
aléatoires).  Pour obtenir une autre série de notes, il suffit de
changer ce nombre.
"

  doctitlefr = "Génération de notes aléatoires"

%% Translation of GIT committish: 8ffecf6be17c6ec2ff87cf31873121a8cce29b09
  texidoces = "
Este fragmento de código basado en Scheme genera
24 notas aleatorias (o tantas como se necesiten), basándose en la
hora actual (o en cualquier número pseudo-aleatorio que se
especifique en su lugar, para obtener las mismas notas aleatorias
cada vez): es decir, para obtener distintos patrones de notas,
sólo tiene que modificar este número.

"
  doctitlees = "Generación de notas aleatorias"

%% Translation of GIT committish: 8ffecf6be17c6ec2ff87cf31873121a8cce29b09
  texidocca = "
Aquest fragment de codi basat en l'Scheme genera 24 notes aleatòries
(o tantes com calguin), basant-se en l'hora actual (o en qualsevol
nombre pseudo-aleatori que s'especifiqui en el seu lloc, per obtenir
les mateixes notes aleatòries cada cop): és a dir, per obtenir
diferents patrons de notes, sols ha de modificar aquest número.
"
  doctitleca = "Generació de notes aleatòries"

  lsrtags = "pitches, really-cool, scheme-language"

  texidoc = "
This Scheme-based snippet generates 24 random notes (or as many as
required), based on the current time (or any randomish number specified
instead, in order to obtain the same random notes each time): i.e., to
get different random note patterns, just change this number.
"

  doctitle = "Generating random notes"
} % begin verbatim


\score {
  {
    $(let ((random-state (seed->random-state (current-time))))
       (make-sequential-music
         (map (lambda (x)
                (let ((idx (random 12 random-state)))
                  (make-event-chord
                   (list
                    (make-music 'NoteEvent
                                'duration (ly:make-duration 2 0 1/1)
                                'pitch (ly:make-pitch
                                        (quotient idx 7)
                                        (remainder idx 7)
                                        0))))))
              (make-list 24))))
  }
}



% ****************************************************************
% end ly snippet
% ****************************************************************
