]> git.donarmstrong.com Git - lilypond.git/blob - input/lsr/creating-a-sequence-of-notes-on-various-pitches.ly
3667374650724ade427ef09d7a53b29c773dd1ce
[lilypond.git] / input / lsr / creating-a-sequence-of-notes-on-various-pitches.ly
1 %% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
2 %% This file is in the public domain.
3 \version "2.13.1"
4
5 \header {
6   lsrtags = "pitches"
7
8 %% Translation of GIT committish: 48f804da6794a7bc8e7fdd4b1649f485b0b09d26
9   texidoces = "
10 En una música que tenga muchas apariciones de la
11 misma secuencia de notas a distintas alturas, podría ser de
12 utilidad la siguiente función musical.  Admite una nota, de la que
13 sólo se utiliza su altura.  Las funciones de apoyo en Scheme se
14 han tomado prestadas del documento de \"Consejos y trucos\" de la
15 versión 2.10 del manual.  Este ejemplo crea las duraciones
16 rítmicas que se usan a todo lo largo de «Marte», de «Los Planetas»
17 de Gustav Holst.
18
19 "
20   doctitlees = "Crear una secuencia de notas a distintas alturas"
21
22   texidoc = "
23 In music that contains many occurrences of the same sequence of notes
24 at different pitches, the following music function may prove useful. 
25 It takes a note, of which only the pitch is used.  The supporting
26 Scheme functions were borrowed from the \"Tips and tricks\" document in
27 the manual for version 2.10.   This example creates the rhythm used
28 throughout Mars, from Gustav Holst's The Planets. 
29
30 "
31   doctitle = "Creating a sequence of notes on various pitches"
32 } % begin verbatim
33
34 #(define (make-note-req p d)
35    (make-music 'NoteEvent
36                'duration d
37                'pitch p))
38
39 #(define (make-note p d)
40    (make-music 'EventChord
41                'elements (list (make-note-req p d))))
42
43 #(define (seq-music-list elts)
44    (make-music 'SequentialMusic
45                'elements elts))
46
47 #(define (make-triplet elt)
48    (make-music 'TimeScaledMusic
49                'denominator 3
50                'numerator 2
51                'element elt))
52
53 rhythm =
54 #(define-music-function (parser location note) (ly:music?)
55    "Make the rhythm in Mars (the Planets) at the given note's pitch"
56    (let ((p (ly:music-property
57              (car (ly:music-property note 'elements))
58              'pitch)))
59      (seq-music-list
60       (list
61        (make-triplet (seq-music-list
62                       (list
63                        (make-note p (ly:make-duration 3 0 2 3))
64                        (make-note p (ly:make-duration 3 0 2 3))
65                        (make-note p (ly:make-duration 3 0 2 3)))))
66        (make-note p (ly:make-duration 2 0))
67        (make-note p (ly:make-duration 2 0))
68        (make-note p (ly:make-duration 3 0))
69        (make-note p (ly:make-duration 3 0))
70        (make-note p (ly:make-duration 2 0))))))
71
72 \new Staff {
73   \time 5/4
74   \rhythm c'
75   \rhythm c''
76   \rhythm g
77 }