Programming questions

2008-04-28 Thread Jay Anderson
A couple of weeks ago I recall reading about someone trying to get
midi trills working. The key needed to be understood so that it could
figure out the correct note to trill to. I can't find the thread to
see if it was resolved. Are there some functions out there for doing
this?


In a few functions I've written they either work correctly inside a
\relative section or correctly outside but not both. Is there a
standard way to make them work in both? When I compile this:
> \displayMusic \relative c' {c c' c,, c'}
> \displayMusic {c' c'' c c'}
both sections display essentially the same contents, but when
manipulating the notes programaticly the pitch octaves need to be
handled differently. I understand why because this:
> \relative c' \displayMusic {c c' c,, c'}
prints the inner section as if it were not relative.

Here (http://article.gmane.org/gmane.comp.gnu.lilypond.general/36789)
is an example designed to work only within a relative section. How
would something like this work both inside and outside a relative
section?

Thanks!

-Jay


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Programming questions

2008-04-28 Thread Peter Chubb
> "Jay" == Jay Anderson <[EMAIL PROTECTED]> writes:

Jay> A couple of weeks ago I recall reading about someone trying to
Jay> get midi trills working. The key needed to be understood so that
Jay> it could figure out the correct note to trill to. I can't find
Jay> the thread to see if it was resolved. Are there some functions
Jay> out there for doing this?

That was me.  I'm still trying to work things out in a general way,
but have a hack that works `well enough' for my current purpose.
Basically, I rely on noting keychange events, and assuming the
starting key is c major.  The current key is in ac:current-key



#(define (ac:up note)
  (let* ((pitch (ly:music-property note 'pitch))
 (notename (ly:pitch-notename pitch))
 (new-notename (if (eq? notename 6) 0 (+ 1 notename)))
 (alterations (ly:music-property ac:current-key 'pitch-alist))
 (new-alteration (cdr (assq new-notename alterations)))
 (new-octave (if (eq? new-notename 0) (+ 1 (ly:pitch-octave pitch))
  (ly:pitch-octave pitch)))
   )
   (set! (ly:music-property note 'pitch)(ly:make-pitch new-octave new-notename 
new-alteration



Jay> In a few functions I've written they either work correctly inside
Jay> a \relative section or correctly outside but not both. Is there a
Jay> standard way to make them work in both? 

Not that I know of.

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au   ERTOS within National ICT Australia
A university is a non-profit organisation only in the sense that it
spends everything it gets  ... Luca Turin.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user