home *** CD-ROM | disk | FTP | other *** search
- ;;TICKINFO.CAL by Hank Hehmsoth - Music Design Group - User ID# 6836
- ;;derives contextual meter signature denominator and numerator at From point
- ;;and presents readout of current meter, timebase denominator (in ticks),
- ;;PPQ, TICKTOTAL (total # of ticks in selected region), and selected
- ;;MUSICLENGTH (elapsed, as in counting from 0) in prevailing meter at From,
- ;;that is, the no. of completed measures, completed beats, and remaining ticks.
- ;; Readout format:
- ;; n/d (tbd) PPQ ___ TICKTOTAL ___ MUSICLENGTH __:__:__
- ;;Don't be confused by MUSICLENGTH. If you select measure 1:0:0 (From) and
- ;;measure 8:0:0 (Thru) you will get a readout of 7:0:1, that is, 7 completed
- ;;measures, no completed beats past those 7 measures, and one tick remaining,
- ;;which is the first tick of measure 8.
- ;; Note that timebase denominator (tbd), the tick value for each beat, can
- ;;be different than PPQ, for instance, if you are in 5/16, then each beat is
- ;;1/4 of PPQ, etc.
- ;;CAUTION: This version of TICKINFO.CAL is valid only if the selected region
- ;;is one meter signature only, so you must select areas that start and end
- ;;in the same meter with no meter changes between!
- ;; Note also, interestingly, all of the calculating is done in the
- ;;Prolog, the Body is skipped, and the readout concludes in the Epilog. This
- ;;allows the routine to run only once, instead of repeatedly for every event
- ;;in the selected region. I have not seen any other CAL routines with a NIL in
- ;;the Body. The essence of CAL is to process events, but in analysis routines
- ;;such as TICKINFO.CAL, "it's nice to bypass".
- ;;USES: 1. Quickly get a count of ticks, and amount of music (in measures,
- ;; beats ,and ticks) for any arbitrarily selected region. I found this
- ;; useful in sequencing for film and checking against SMPTE times.
- ;; 2. Getting metric info into a format CAL understands. Initially, I
- ;; prompted the user for meter info, but found CAL could, with some
- ;; help, figure it on its own. You can "lift" a routine section for
- ;; your own purposes. For instance, one could insert 13 equally spaced
- ;; beats across 7 measures, or any selected region with these routines.
- ;; Or grab beats in 3/8, and force them into 4, or 5, against 3/8, that
- ;; is, polyrhythms and cross rhythms. Lastly, to create a different
- ;; version of TICKINFO.CAL entirely, you can move these routines into
- ;; the CAL body, derive tickcounts on a per measure basis, enabling
- ;; TICKINFO.CAL to work on selected regions of polymeter, for instance,
- ;; 1/4, 5/16, 3/8, 7/4, 2/2, all in one region.
- ;;
- ;;Prolog - does almost all the work before Body
- (do
- (dword tb TIMEBASE)
- (dword tbd 0)
- (dword a 0)
- (dword b 0)
- (dword c 0)
- (dword d 0)
- (dword e 0)
- (dword n 1)
- ;;this section derives timebase denominator in ticks and sets denominator
- ;;Cakewalk allows 6 meter denominators, hence d can only = 32,16,8,4,2,or 1.
- (= a (tick From))
- (= Now From)
- (switch a
- (tick (+ Now (/ tb 8)))
- (do
- (= tbd (/ tb 8))
- (= d 32)
- )
- (tick (+ Now (/ tb 4)))
- (do
- (= tbd (/ tb 4))
- (= d 16)
- )
- (tick (+ Now (/ tb 2)))
- (do
- (= tbd (/ tb 2))
- (= d 8)
- )
- (tick (+ Now tb))
- (do
- (= tbd tb)
- (= d 4)
- )
- (tick (+ Now (* tb 2)))
- (do
- (= tbd (* tb 2))
- (= d 2)
- )
- (tick (+ Now (* tb 4)))
- (do
- (= tbd (* tb 4))
- (= d 1)
- )
- )
- ;;this section calculates the numerator
- (= Now From)
- (+= Now tbd)
- (while (!= (beat From) (beat Now))
- (do
- (+= Now tbd)
- (+= n 1)
- )
- )
- ;;this section sets e to TICKTOTAL of selected region length
- (= e (+ 1 (- Thru From)))
- ;;this section converts selected region length into elapsed musical time
- (= c (- e (* tbd (/ e tbd))))
- (= b (- (/ e tbd) (* n (/ (/ e tbd) n))))
- (= a (/ (/ e tbd) n))
- )
- ;;Body -sets a NIL placeholder avoiding the loop function
- NIL
- ;;Epilog displays info
- (do
- (pause " " n "/ " d "( " tbd ") PPQ " TIMEBASE "TICKTOTAL= " e "MUSICLENGTH= " a ":" b ":" c "<enter> to end")
- (= Now From)
- )