lilypond-user
[Top][All Lists]
Advanced

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

Re: flam snippet not working


From: David Kastrup
Subject: Re: flam snippet not working
Date: Fri, 16 Aug 2013 21:07:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Roel Spruit <address@hidden> writes:
>> flam =
>> #(define-music-function (parser location note) (ly:music?)
>>    "Return { \\grace { note8 } note }."
>>    (let ((mypitch (ly:music-property (first (ly:music-property note 
>> 'elements))
>>                                      'drum-type)))
>>      (make-sequential-music
>>       (list (make-grace-music
>>              (make-sequential-music
>>               (list
>>                (context-spec-music
>>                 (make-grob-property-set 'Stem
>>                                         'stroke-style "grace")
>>                 'Bottom)
>>                (make-event-chord
>>                 (list (make-music 'NoteEvent
>>                                   'duration (ly:make-duration 3 0 1 1)
>>                                   'drum-type mypitch))))))
>>             note))))
>
> Try something like
> flam =
> #(define-music-function (parser location note) (ly:music?)
>   "Return { \\slashedGrace { note8 } note }."
>   #{ \slashedGrace {
>      $(let ((m (ly:music-deep-copy note)))
>         (set! (ly:music-property m 'duration)
>               (ly:make-duration 3 0 1 1))
>         m) } $m #})

Somewhat more robust in the presence of chords etc:

flam =
#(define-music-function (parser location note) (ly:music?)
  "Return { \\slashedGrace { note8 } note }."
  #{ \slashedGrace {
       $(map-some-music
          (lambda (m)
            (and (ly:duration? (ly:music-property m 'duration))
                 (begin
                   (set! (ly:music-property m 'duration)
                         (ly:make-duration 3 0 1 1))
                   m)))
          (ly:music-deep-copy note)) }
       $m #})

-- 
David Kastrup




reply via email to

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