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