Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
LilyPond wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Easy Rhythm Template Creation
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Many times a piece will repeat the same rhythm on different notes. This is tedious to write manually. This snippet allows for easy creation of rhythm templates. <lilypond version="2.24.0"> %% http://lsr.di.unimi.it/LSR/Item?id=465 %LSR This snippet was contributed by Jay Anderson %=> http://comments.gmane.org/gmane.comp.gnu.lilypond.general/37271 %LSR upgraded by Harm on Feb.2014 for v2.18 %LSR upgraded by David Kastrup on Feb.2014 for v2.18 %=> http://lilypond.1069038.n5.nabble.com/LSR-v-2-18-quot-Easy-Rhythm-Template-Creation-quot-does-not-compile-tt159397.html#a159859 rhythmTemplate = #(define-scheme-function (pattern) (ly:music?) (define-music-function (chord) (ly:music?) (make-relative (chord) chord (map-some-music (lambda (m) (and (music-is-of-type? m 'skip-event) (let ((dur (ly:music-property m 'duration)) (art (ly:music-property m 'articulations)) (res (ly:music-deep-copy chord))) ;; transfer duration of skip to all elements with duration (for-some-music (lambda (c) (and (ly:duration? (ly:music-property c 'duration)) (begin (set! (ly:music-property c 'duration) dur) #t))) res) ;; transfer articulations of skip to all relevant targets (for-some-music (lambda (c) (let ((prop (cond ((music-is-of-type? c 'event-chord) 'elements) ((music-is-of-type? c 'rhythmic-event) 'articulations) (else #f)))) (and prop (begin (set! (ly:music-property c prop) (append (ly:music-property c prop) art)) #t)))) res) res))) (ly:music-deep-copy pattern))))) rhya = \rhythmTemplate { s8.-> s16 s8 } rhyb = \rhythmTemplate { s8[ r16 s16 s8] } rhyc = \rhythmTemplate { s16 s~ s4 } rhyd = \rhythmTemplate { \times 2/3 { s8 s8 s8 } s4 s4 s8 s8 s4 } rhye = \rhythmTemplate { \times 2/3 { s8---\pp s8-- s8-- } s4-- s4-- s8-- s8-- s4-- } rhyf = \rhythmTemplate { \times 2/3 { s4 \times 2/3 { s8 s-> s } s4 } } \score { \new Staff \relative c' { \time 6/8 \rhya c \rhyb c' | \rhya <c, e> \rhyb <c f> | \rhyc <c e> \rhyc <c d> | \time 5/4 \rhyd c \rhyd e \rhye <c e g> \time 4/4 \rhyf c \rhyf d } } </lilypond> [[Category:Rhythms]] [[Category:Syntax and expressions]] [[Category:Scheme]] [[Category:Automatic notation]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Easy Rhythm Template Creation
Add topic