Splitting chords: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
This snippet is a 2009 contribution by Gilles Thibault in [https://lists.gnu.org/archive/html/lilypond-user/2009-01/msg00685.html lilypond-user]. It provides two functions to split a chord sequence into two separate voices, also preserving articulations and slurs: <code>\keepOnlyFirstNote</code> extracts the first note (as given in the input; this is usually the lowest one) of every chord, and <code>\deleteFirstNote</code> collects the remaining notes. | This snippet is a 2009 contribution by Gilles Thibault in [https://lists.gnu.org/archive/html/lilypond-user/2009-01/msg00685.html lilypond-user]. It provides two functions to split a chord sequence into two separate voices, also preserving articulations and slurs: <code>\keepOnlyFirstNote</code> extracts the first note (as given in the input; this is usually the lowest one) of every chord, and <code>\deleteFirstNote</code> collects the remaining notes. | ||
Note that these functions don't support < | Note that these functions don't support <code>q</code> to repeat the last chord. | ||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
| Line 11: | Line 11: | ||
keepOnlyFirstNote = | keepOnlyFirstNote = | ||
#(define-music-function ( | #(define-music-function (music) (ly:music?) | ||
(music-map | (music-map | ||
(lambda (evt) | (lambda (evt) | ||
| Line 25: | Line 25: | ||
deleteFirstNote = | deleteFirstNote = | ||
#(define-music-function ( | #(define-music-function (music) (ly:music?) | ||
(music-map | (music-map | ||
(lambda (evt) | (lambda (evt) | ||