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

  1. ; Scott Michael Kemp - Serial Number: 400899 - CP - 4.0
  2.  
  3. ; SINGLE.CAL
  4. ;
  5. ; Makes sure that a monophony solo or bass line has no overlapping notes by
  6. ; making the offending (overlapping) note shorter.
  7. ;
  8. ; Overlapping notes will cause problems with some synths in that the note
  9. ; that is getting overlapped by the first will cut off at the same time
  10. ; as the first.  This routine makes sure that will never happen
  11. ;
  12. ; The routine asks the user for a safety margin in Ticks.  Some slower synths
  13. ; will require a longer safety margin
  14. ;
  15. ; Note: If no notes are overlapping, this routine does nothing.
  16.  
  17.  
  18.  
  19. ; prolog
  20. (do 
  21.    (int   fudgeTime 1)
  22.     (dword oTime 0)       ; previous time
  23.     (int   oChannel -1)   ; previous channel
  24.     (int   oVelocity 0)   ; previous velocity
  25.     (int   oNote 0)       ; previous note (pitch)
  26.     (word  oDuration 0)   ; previous duration
  27.     (word newDuration 0)  ; the calculated previous durations
  28.     (dword timeDif 0)     ; temp varirable
  29.     (getInt fudgeTime "How much safety margin would you like (in ticks)" 0 10)
  30. )
  31.  
  32. ; body
  33. (if (== Event.Kind NOTE)
  34.    (do
  35.       (if (== oChannel -1) ; if this is the very first event...
  36.             (do
  37.                  ; store values
  38.                  (= oTime     Event.Time)
  39.                  (= oChannel  Event.Chan)
  40.                  (= oNote     Note.Key)
  41.                  (= oVelocity Note.Vel)
  42.                  (= oDuration Note.Dur))
  43.  
  44.              (do
  45.                  ; else compute the time difference
  46.                  (= timeDif (- Event.Time oTime))
  47.                  (if (> timeDif (+ oDuration fudgeTime))
  48.                       (= newDuration oDuration)
  49.                       (= newDuration (- timeDif fudgeTime)))
  50.  
  51.              ; insert the previously deleted note
  52.                  (insert oTime oChannel NOTE oNote oVelocity newDuration)
  53.  
  54.                  ; store values
  55.                  (= oTime     Event.Time)
  56.              (= oChannel  Event.Chan)
  57.              (= oNote     Note.Key)
  58.              (= oVelocity Note.Vel)
  59.              (= oDuration Note.Dur)
  60.           )
  61.      )
  62.     (delete) ; delete the current event
  63.     )
  64.     NIL
  65. )
  66.  
  67.  
  68. ; insert the last event that is stored in the variables
  69. (insert oTime oChannel NOTE oNote oVelocity oDuration)
  70.                        
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.