Timothy,

That is absolutely fantastic! What a great way to set up and use 
instruments! Great work!

- Abraham

On 7/23/2015 2:59 PM, Timothy Lanfear-2 [via Lilypond] wrote:
> On 19/07/15 18:27, Timothy Lanfear wrote:
> >> On 19 Jul 2015, at 19:12, Peter Gentry <[hidden email] 
> </user/SendEmail.jtp?type=node&node=179000&i=0>> wrote:
> >>
> >> The OP described wanting to tweak a note property depending on its 
> pitch. Now I may be missing something but do you need to create
> >> an engraver for this.
> >>
> > I am after something like your solution. Part of my motivation was 
> to learn how engravers work. I can follow up with more detail in a few 
> days when I return home.
>
> I mostly use LilyPond to transcribe and arrange music for my recorder
> group. Being fed up with repeating the same boiler plate for each piece,
> I set up some infrastructure to help.
>
> Loosely inspired by \addInstrumentDefinition, I create definitions for
> each size of recorder like this,
>
> #(add-instrument-definition 'Descant
>     `((instrumentName      . "Descant Recorder")
>       (shortInstrumentName . "D")
>       (instrumentCueName   . "Descant")
>       (clef                . "treble^8")
>       (range               . (,(ly:make-pitch 0 6 1/2) ,(ly:make-pitch 3
> 1 0)))
>       (midiInstrument      . "recorder")))
>
> which is enough to calculate the additional arcana like clefPosition,
> middleCPosition and build pre-defined contexts for each size of
> recorder, and a RecorderConsort context that accepts them. So I can now
> write
>
> \new RecorderConsort <<
>    \new Descant { ... }
>    \new Treble { ... }
>    \new Tenor { ... }
>    \new Bass { ... }
>  >>
>
> and automatically get the right clef, midi instrument and labels like
> instrumentName.
>
> When arranging it is handy to be able to spot notes outside the range of
> the instrument by colouring them, e.g.
>
> \new RecorderConsort <<
>    \new Descant \with { \outOfRange } { ... }
>    \new Treble { ... }
>    \new Tenor { ... }
>    \new Bass { ... }
>  >>
>
> An engraver to do this could be
>
> outOfRangeEngraver =
> #(lambda (context)
>   (let* ((instrument (ly:context-name context))
>          (inst-def   (ly:assoc-get instrument instrument-definitions))
>          (range      (ly:assoc-get 'range inst-def))
>          (low        (first  range))
>          (high       (second range)))
>     (make-engraver
>       (acknowledgers
>         ((note-head-interface engraver grob source-engraver)
>          (let* ((cause (ly:grob-property  grob  'cause))
>                 (pitch (ly:event-property cause 'pitch)))
>            (if (or (ly:pitch<? pitch low) (ly:pitch<? high pitch))
>              (ly:grob-set-property! grob 'color red))))))))
>
> outOfRange = \with { \consists \outOfRangeEngraver }
>
> -- 
> Timothy Lanfear, Bristol, UK.
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=179000&i=1>
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://lilypond.1069038.n5.nabble.com/Tweaking-in-an-engraver-tp178745p179000.html
>  
>
> To start a new topic under User, email ml-node+s1069038n...@n5.nabble.com
> To unsubscribe from Lilypond, click here 
> <http://lilypond.1069038.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=dGlzaW1zdC5saWx5cG9uZEBnbWFpbC5jb218Mnw4MzU3Njg3MDU=>.
> NAML 
> <http://lilypond.1069038.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>  
>





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Tweaking-in-an-engraver-tp178745p179001.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to