home *** CD-ROM | disk | FTP | other *** search
- ; Scott Michael Kemp - Serial Number: 400899 - CP - 4.0
-
- ; SINGLE.CAL
- ;
- ; Makes sure that a monophony solo or bass line has no overlapping notes by
- ; making the offending (overlapping) note shorter.
- ;
- ; Overlapping notes will cause problems with some synths in that the note
- ; that is getting overlapped by the first will cut off at the same time
- ; as the first. This routine makes sure that will never happen
- ;
- ; The routine asks the user for a safety margin in Ticks. Some slower synths
- ; will require a longer safety margin
- ;
- ; Note: If no notes are overlapping, this routine does nothing.
-
-
-
- ; prolog
- (do
- (int fudgeTime 1)
- (dword oTime 0) ; previous time
- (int oChannel -1) ; previous channel
- (int oVelocity 0) ; previous velocity
- (int oNote 0) ; previous note (pitch)
- (word oDuration 0) ; previous duration
- (word newDuration 0) ; the calculated previous durations
- (dword timeDif 0) ; temp varirable
- (getInt fudgeTime "How much safety margin would you like (in ticks)" 0 10)
- )
-
- ; body
- (if (== Event.Kind NOTE)
- (do
- (if (== oChannel -1) ; if this is the very first event...
- (do
- ; store values
- (= oTime Event.Time)
- (= oChannel Event.Chan)
- (= oNote Note.Key)
- (= oVelocity Note.Vel)
- (= oDuration Note.Dur))
-
- (do
- ; else compute the time difference
- (= timeDif (- Event.Time oTime))
- (if (> timeDif (+ oDuration fudgeTime))
- (= newDuration oDuration)
- (= newDuration (- timeDif fudgeTime)))
-
- ; insert the previously deleted note
- (insert oTime oChannel NOTE oNote oVelocity newDuration)
-
- ; store values
- (= oTime Event.Time)
- (= oChannel Event.Chan)
- (= oNote Note.Key)
- (= oVelocity Note.Vel)
- (= oDuration Note.Dur)
- )
- )
- (delete) ; delete the current event
- )
- NIL
- )
-
-
- ; insert the last event that is stored in the variables
- (insert oTime oChannel NOTE oNote oVelocity oDuration)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-