]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/creating-a-sequence-of-notes-on-various-pitches.ly
Docs: run convert-ly for 2.14.0.
[lilypond.git] / Documentation / snippets / creating-a-sequence-of-notes-on-various-pitches.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 En una música que tenga muchas apariciones de la
15 misma secuencia de notas a distintas alturas, podría ser de
16 utilidad la siguiente función musical.  Admite una nota, de la que
17 sólo se utiliza su altura.  Las funciones de apoyo en Scheme se
18 han tomado prestadas del documento de \"Consejos y trucos\" de la
19 versión 2.10 del manual.  Este ejemplo crea las duraciones
20 rítmicas que se usan a todo lo largo de «Marte», de «Los Planetas»
21 de Gustav Holst.
22
23 "
24   doctitlees = "Crear una secuencia de notas a distintas alturas"
25
26   texidoc = "
27 In music that contains many occurrences of the same sequence of notes
28 at different pitches, the following music function may prove useful.
29 It takes a note, of which only the pitch is used.   This example
30 creates the rhythm used throughout Mars, from Gustav Holst's The
31 Planets.
32
33 "
34   doctitle = "Creating a sequence of notes on various pitches"
35 } % begin verbatim
36
37 #(define (make-note-req p d)
38    (make-music 'NoteEvent
39                'duration d
40                'pitch p))
41
42 #(define (make-note p d)
43    (make-music 'EventChord
44                'elements (list (make-note-req p d))))
45
46 #(define (make-triplet elt)
47    (make-music 'TimeScaledMusic
48                'denominator 3
49                'numerator 2
50                'element elt))
51
52 rhythm =
53 #(define-music-function (parser location note) (ly:music?)
54    "Make the rhythm in Mars (the Planets) at the given note's pitch"
55    (let ((p (ly:music-property
56              (car (ly:music-property note 'elements))
57              'pitch)))
58      (make-sequential-music
59       (list
60        (make-triplet (make-sequential-music
61                       (list
62                        (make-note p (ly:make-duration 3 0 2 3))
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 2 0))
66        (make-note p (ly:make-duration 2 0))
67        (make-note p (ly:make-duration 3 0))
68        (make-note p (ly:make-duration 3 0))
69        (make-note p (ly:make-duration 2 0))))))
70
71 \new Staff {
72   \time 5/4
73   \rhythm c'
74   \rhythm c''
75   \rhythm g
76 }