lilypond-user
[Top][All Lists]
Advanced

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

generalize the idea in snippet 372


From: Wilbert Berendsen
Subject: generalize the idea in snippet 372
Date: Sun, 3 May 2009 07:50:32 +0200
User-agent: KMail/1.11.2 (Linux/2.6.28-11-generic; KDE/4.2.2; i686; ; )

Hi,

based on the idea of http://lsr.dsi.unimi.it/LSR/Item?id=372 I created this 
small function that creates a filtering function to remove certain event types 
from a music expression:

#(define-public (define-music-event-filter names)
  (define-music-function (parser location music) (ly:music?)
    (music-filter
      (lambda (event) (not (member (ly:music-property event 'name) names)))
      music)))

This function can then be used to create a custom filtering function like 
this:

filterdynamics = #(define-music-event-filter 
  '(AbsoluteDynamicEvent CrescendoEvent DecrescendoEvent TextScriptEvent))

music = \relative c' {
  c\p\< d e f g\ff
}

\score { \new Staff \filterdynamics \music }

This makes using this idea easier: you don't have to copy and re-edit the 
filterOneEvent function each time. Filtering music expressions is useful to 
e.g. create a piano reduction from orchestral parts.

best regards,
Wilbert Berendsen

-- 
Frescobaldi, LilyPond editor for KDE: http://www.frescobaldi.org/




reply via email to

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