home *** CD-ROM | disk | FTP | other *** search
/ PC Musician 2000 / PC_Musician_2000.iso / PCMUSIC / SEQUENCE / CAL_CONT / VARYVEL.CAL < prev   
Encoding:
Text File  |  1991-08-25  |  2.4 KB  |  82 lines

  1. ; Author: Douglas A. Delaney    User ID:142       VARYVEL.CAL
  2. ;
  3. ; This will ask the user for the highest and lowest VELOCITY values that
  4. ; each NOTE event should be randomly set between in the selected region.
  5. ;
  6. ; by Doug Delaney (313)-585-5473
  7. ;    208 La Plaza Ct.
  8. ;    Royal Oak, MI 48073
  9. ;    Any comments, suggestions or criticisms are welcome
  10. ;
  11. ; Useage: This can be very benefitial if you have a keyboard that is
  12. ;         NOT touch-sensitive, or a drum machine.  I find it particularly
  13. ;         helpful for making Hi-Hat parts sound Human.
  14. ;
  15. ; Note: the Message command at the start of the DO loop at the top of
  16. ;       the body section adds to the execution time.  I put it in so
  17. ;       I can see something happening...  Delete the line, or
  18. ;       comment it out to decrease processing time.
  19. ;
  20. ;
  21. ; This routine demonstrates the use of STRING variables to produce a line of 
  22. ; text to display in the Message Line that is too long to be entered as a
  23. ; single Message command.  The text itself is less than 80 characters, but
  24. ; the CAL editor will not let you edit a line longer than 80, which, by the
  25. ; time the Message command (to display the text) is added to the text, the
  26. ; total is more than 80.
  27. ;
  28. ; prolog
  29. (do
  30.     (string use "Use to randomly change velocities within LOW and HIGH")
  31.     (string use2 " limits  ** PRESS ANY KEY **")
  32.     (string hlp "  ESC to Abort <or> Any Other Key")
  33.     (int low 40)
  34.     (int high 90)
  35.     (int new 0)
  36.     (dword ave 0)
  37.     (word count 0)
  38.   (getInt low "Low limit of Velocity Range" 0 127)
  39.   (getInt high "High limit of Velocity Range" 0 127)
  40.  )
  41. ;body
  42. (do
  43.   (message "Event #" (index) "Low:" low "High:" high hlp)
  44.   ;Delete the line above this one to speed up processing
  45.   (if (== Event.Kind NOTE)
  46.     (do
  47.       (++ count)
  48.       (if (< Note.Vel low)
  49.         (= low Note.Vel)
  50.         NIL
  51.       )
  52.       (if (>= Note.Vel low)
  53.         (do
  54.           (+= new (random low high))
  55.           (= Note.Vel new)
  56.           )
  57.         NIL
  58.       )
  59.       (= new 0)
  60.       (if (> Note.Vel high)
  61.         (= high Note.Vel)
  62.         NIL
  63.       )
  64.       (if (<= Note.Vel high)
  65.         (do
  66.           (+= new (random low high))
  67.           (= Note.Vel new)
  68.         )
  69.         NIL
  70.       )
  71.       (= new 0)
  72.       (+= ave Note.Vel)
  73.      )
  74.    NIL
  75.   )
  76. )
  77. ;epilog
  78. (do
  79.  (/= ave count)
  80.  (pause "Low=" low " High=" high " Ave.=" ave " # Notes changed=" count hlp)
  81. )
  82.