lilypond-user
[Top][All Lists]
Advanced

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

Re: Generating music expressions from within \applyContext?


From: H. S. Teoh
Subject: Re: Generating music expressions from within \applyContext?
Date: Tue, 26 Jul 2016 09:48:33 -0700
User-agent: Mutt/1.6.0 (2016-04-01)

On Tue, Jul 26, 2016 at 09:48:36AM +0200, David Kastrup wrote:
> "H. S. Teoh" <address@hidden> writes:
[...]
> > The background of this is that I'm writing a Scheme function that
> > generates single-note crescendos by emitting a series of \set
> > Staff.midiExpression = ... events.
> 
> Oh, but that's perfectly manageable with \applyContext.  Don't
> generate any events, just call ly:context-set-property! directly.  If
> you don't want to find Staff yourself, you can just write
> 
> \context Staff \applyContext (lambda ...
> 
> and then the context passed to the applyContext function will already
> be a Staff context.

Sound good, but how do I set the property at evenly-spaced time
intervals from inside the lambda?

The main problem I'm having is that the number of intervals will differ
depending on the volume levels of the given dynamics. Since the MIDI
expression controller only has 127 discrete volume levels, if I'm going
from 0 to 127 then I'd need 127 property changes, but if I'm going from
64 to 96 I only need 32 property changes.  But I wouldn't know this
until the \applyContext lambda is called. How do I insert property
changes at regularly-spaced intervals from inside the lambda?


[...]
> So far it does not sound like you want anything returned rather than
> setting some properties.
[...]

True, so perhaps there is a way after all.  It's just that so far I've
only really worked with music expressions and grobs when it comes to
Scheme, and haven't quite figured out what happens to these objects
afterwards. :-P


T

-- 
If Java had true garbage collection, most programs would delete themselves upon 
execution. -- Robert Sewell



reply via email to

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