lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Force minor trill playback


From: Gilberto Agostinho
Subject: Force minor trill playback
Date: Mon, 30 Nov 2015 05:14:56 -0700 (MST)

Hi all,

In case someone else will find this useful, here is a way to force all
trills to be minor:

\include "articulate.ly"
\version "2.19.28"

#(define (ac:trill music)
  (let* ((hemisemidur (ly:make-duration 5 0 1/1))
         (orig-len  (ly:music-length music))
         (t (ac:twiddletime music))
         (uppernote '())
         (note_moment (ly:moment-mul t (ly:make-moment 1/2)))
         (c1 (ly:moment-div orig-len t))
         (c2 (inexact->exact
              (round (/ (ly:moment-main-numerator c1)
                      (* 2 (ly:moment-main-denominator c1))))))
         (count (if (< c2 2) 2 c2)))

   (set! (ly:music-property music 'elements)
    (filter (lambda (y) (eq? 'NoteEvent (ly:music-property y 'name)))
     (ly:music-property music 'elements)))
   (map (lambda (y) (ac:setduration y hemisemidur))
    (ly:music-property music 'elements))
   (set! uppernote (ly:music-transpose (ly:music-deep-copy music)
(ly:make-pitch 0 0 SHARP)))

   (let* ((trillMusicElements
          (let loop ((so_far (list uppernote music))
                     (c count))
           (if (> c 1)
            (loop (append (list (ly:music-deep-copy uppernote)
(ly:music-deep-copy music)) so_far) (1- c))
            so_far)))
          (trillMusic (make-sequential-music trillMusicElements))
          (newlen (ly:music-length trillMusic))
          (factor (ly:moment-div  orig-len newlen)))
    (ly:music-compress trillMusic factor)
)))

music = { \time 2/4 c'4\startTrillSpan d' e' fis'}

\score { 
  \unfoldRepeats \new Staff \articulate \music
  \midi {}
}

Cheers,
Gilberto



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Force-minor-trill-playback-tp184281.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]