home *** CD-ROM | disk | FTP | other *** search
/ PC Musician 2000 / PC_Musician_2000.iso / PCMUSIC / SEQUENCE / CAL_CONT / TICKINFO.CAL < prev    next >
Encoding:
Text File  |  1991-09-07  |  4.0 KB  |  109 lines

  1. ;;TICKINFO.CAL by Hank Hehmsoth - Music Design Group - User ID# 6836
  2. ;;derives contextual meter signature denominator and numerator at From point
  3. ;;and presents readout of current meter, timebase denominator (in ticks),
  4. ;;PPQ, TICKTOTAL (total # of ticks in selected region), and selected
  5. ;;MUSICLENGTH (elapsed, as in counting from 0) in prevailing meter at From,
  6. ;;that is, the no. of completed measures, completed beats, and remaining ticks.
  7. ;;    Readout format:
  8. ;;    n/d  (tbd)  PPQ ___    TICKTOTAL ___  MUSICLENGTH  __:__:__
  9. ;;Don't be confused by MUSICLENGTH. If you select measure 1:0:0 (From) and
  10. ;;measure 8:0:0 (Thru) you will get a readout of 7:0:1, that is, 7 completed
  11. ;;measures, no completed beats past those 7 measures, and one tick remaining,
  12. ;;which is the first tick of measure 8.
  13. ;;    Note that timebase denominator (tbd), the tick value for each beat, can
  14. ;;be different than PPQ, for instance, if you are in 5/16, then each beat is
  15. ;;1/4 of PPQ, etc.
  16. ;;CAUTION: This version of TICKINFO.CAL is valid only if the selected region
  17. ;;is one meter signature only, so you must select areas that start and end
  18. ;;in the same meter with no meter changes between!
  19. ;;    Note also, interestingly, all of the calculating is done in the
  20. ;;Prolog, the Body is skipped, and the readout concludes in the Epilog. This
  21. ;;allows the routine to run only once, instead of repeatedly for every event
  22. ;;in the selected region. I have not seen any other CAL routines with a NIL in
  23. ;;the Body. The essence of CAL is to process events, but in analysis routines
  24. ;;such as TICKINFO.CAL, "it's nice to bypass".
  25. ;;USES: 1. Quickly get a count of ticks, and amount of music (in measures,
  26. ;;         beats ,and ticks) for any arbitrarily selected region. I found this
  27. ;;         useful in sequencing for film and checking against SMPTE times.
  28. ;;      2. Getting metric info into a format CAL understands. Initially, I
  29. ;;       prompted the user for meter info, but found CAL could, with some
  30. ;;       help, figure it on its own. You can "lift" a routine section for
  31. ;;       your own purposes. For instance, one could insert 13 equally spaced
  32. ;;       beats across 7 measures, or any selected region with these routines.
  33. ;;       Or grab beats in 3/8, and force them into 4, or 5, against 3/8, that
  34. ;;       is, polyrhythms and cross rhythms. Lastly, to create a different
  35. ;;       version of TICKINFO.CAL entirely, you can move these routines into
  36. ;;       the CAL body, derive tickcounts on a per measure basis, enabling
  37. ;;       TICKINFO.CAL to work on selected regions of polymeter, for instance,
  38. ;;       1/4, 5/16, 3/8, 7/4, 2/2, all in one region.
  39. ;;
  40. ;;Prolog - does almost all the work before Body
  41. (do
  42.  (dword tb TIMEBASE)
  43.  (dword tbd 0)
  44.  (dword a 0)
  45.  (dword b 0)
  46.  (dword c 0)
  47.  (dword d 0)
  48.  (dword e 0)
  49.  (dword n 1)
  50. ;;this section derives timebase denominator in ticks and sets denominator
  51. ;;Cakewalk allows 6 meter denominators, hence d can only = 32,16,8,4,2,or 1.
  52.  (= a (tick From))
  53.  (= Now From)
  54.  (switch a
  55.     (tick (+ Now (/ tb 8)))
  56.         (do
  57.          (= tbd (/ tb 8))
  58.          (= d 32)
  59.         )
  60.     (tick (+ Now (/ tb 4)))
  61.         (do
  62.          (= tbd (/ tb 4))
  63.          (= d 16)
  64.         )
  65.     (tick (+ Now (/ tb 2)))
  66.         (do
  67.          (= tbd (/ tb 2))
  68.          (= d 8)
  69.         )
  70.     (tick (+ Now tb))
  71.         (do
  72.          (= tbd tb)
  73.         (= d 4)
  74.         ) 
  75.     (tick (+ Now (* tb 2)))
  76.         (do
  77.          (= tbd (* tb 2))
  78.          (= d 2)
  79.         )
  80.     (tick (+ Now (* tb 4)))
  81.         (do
  82.          (= tbd (* tb 4))
  83.          (= d 1)
  84.         )
  85.  )
  86. ;;this section calculates the numerator
  87.  (= Now From)
  88.  (+= Now tbd)
  89.  (while (!= (beat From) (beat Now))
  90.       (do
  91.        (+= Now tbd)
  92.        (+= n 1)
  93.     )
  94.  )
  95. ;;this section sets e to TICKTOTAL of selected region length
  96.  (= e (+ 1 (- Thru From)))
  97. ;;this section converts selected region length into elapsed musical time
  98.  (= c (- e (* tbd (/ e tbd))))
  99.  (= b (- (/ e tbd) (* n (/ (/ e tbd) n))))  
  100.  (= a (/ (/ e tbd) n))
  101. )
  102. ;;Body -sets a NIL placeholder avoiding the loop function
  103. NIL
  104. ;;Epilog displays info
  105. (do
  106.  (pause " " n "/ " d "( " tbd ") PPQ " TIMEBASE "TICKTOTAL= " e "MUSICLENGTH= " a ":" b ":" c "<enter> to end")
  107.  (= Now From)
  108. )
  109.