> \time 2/4 > r4 a4 ~ | > a4 b4 ~| > b4 r4 > How can I shift (convert) it to: > \time 2/4 > a2 | > b2 | > r4
For "shifting" rhythm, you can use this snippet : http://lsr.di.unimi.it/LSR/Item?id=542 To transform 2 tied notes into a single note, you have to make your own function... ---------------------------------------------------------------------------- \include "extractMusic.ly" %% to download here %% http://gillesth.free.fr/Lilypond/extractMusic/ #(define (name-of music) (ly:music-property music 'name)) %% TODO: this function probably does not work with chords -:( twoTiedNotesToOneNote = #(define-music-function (parser location music) (ly:music?) "Transform 2 tied notes in a note with a length equal to the sum of their lengths" (let loop ((notes (reverse ;; easier for managing multiple tied notes) (extract-named-music music 'NoteEvent ;; 'EventChords )))) (if (or (null? notes)(null? (cdr notes))) (music-filter (lambda(mus)(not (eq? 'Music (name-of mus)))) music) (let ((note1 (first notes)) (note2 (second notes))) ;; (display "-------------"\n) ;; (display-scheme-music note1) ;; (display-scheme-music note2) (if (pair? (extract-named-music note2 'TieEvent)) (let* ((mom1 (ly:music-length note1)) (mom2 (ly:music-length note2)) (new-mom2 (ly:moment-add mom1 mom2)) ;; the following moment->rhythm function ;; is defined in "extractMusic.ly" (new-dur2 (moment->rhythm new-mom2))) (ly:music-set-property! note2 'duration new-dur2) (ly:music-set-property! note2 'articulations (filter (lambda(mus)(not (eq? 'TieEvent (name-of mus)))) (ly:music-property note2 'articulations))) ;; (set! note1 (ly:make-music 'Music)) ;; doesn't work... (ly:music-set-property! note1 'name 'Music))) ;; well, changing the property 'name is not "standard" (loop (cdr notes)))))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% music = { \time 2/4 r4 a4-"4" ~ a4-"3" b4-"2" ~ b4-"1" r4 } \new Staff \music \new Staff { \time 2/4 \extractEnd \twoTiedNotesToOneNote \music s4 } music = \relative c' { s2. s8. d16 ~ % 31 d8. d16 ~ d8 b'16 b16 ~ b16 b8 b16 ~ b16 b8 b16 ~ % 32 b8 a16 g16 ~ g4 } \new Staff \music \new Staff { \extractEnd \twoTiedNotesToOneNote \music { s2. s8. } } -------------------------------------------------------------- Note that if you "shift" rhythm, you have to delete barcheck | -- Gilles _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user