[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Programming questions
From: |
Peter Chubb |
Subject: |
Re: Programming questions |
Date: |
Tue, 29 Apr 2008 16:42:49 +1000 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 MULE XEmacs/21.4 (patch 21) (Educational Television) (x86_64-linux-gnu) |
>>>>> "Jay" == Jay Anderson <address@hidden> 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.