
SergeD
New member
This script randomize pitch, velocity, duration and time event.
May be good to bring little variations on tracks.
;; ---------------------------
;; __Randomizer.Cal, by Serge Daigneault 2005
;; Insert random pitch, velocity, duration and event time
;; Be careful with Variation values. Values below 2 will conduct to and endless loop trap.
(do
(int PitchVar 6) ; Pitch variation may be changed
(int VelVar 5) ; Velocity variation may be changed
(int DurVar 10) ; Duration variation may be changed
(int EveVar 5) ; Event time variation may be changed
(int NoteVel 0) ; If NoteVel = 0 Note.Vel is used, otherwise NoteVel is used
(int NoteDur 0) ; If NoteDur = 0 Note.Dur is used, otherwise NoteDur is used
(int VelVal 0)
(int DurVal 0)
(int EveVal 0)
(int NewPitch 0)
(int OldPitch 0)
(int NewVel 0)
(int OldVel 0)
(int NewDur 0)
(int OldDur 0)
(int NewEve 0)
(int OldEve 0)
(int Channel 0)
(do
(forEachEvent
(do
(if (== Event.Kind NOTE)
(do
(= NewPitch OldPitch)
(= NewVel OldVel)
(= VelVal Note.Vel)
(if (> NoteVel 0) (= VelVal NoteVel)) ; instead of Note.Vel used
(= NewDur OldDur)
(= DurVal Note.Dur) ; or any constant number
(if (> NoteDur 0) (= DurVal NoteDur)) ; instead of Note.Dur used
(= NewEve OldEve)
(= Channel Event.Chan)
; Randomize pitch, velocity, duration and Time event. No repeating equal values ...
(while ( || ( || (|| (== NewPitch OldPitch) (== NewVel OldVel)) (== NewDur OldDur)) (== NewEve OldEve))
(do
(= NewPitch (* 15 (random (* -1 PitchVar) PitchVar))) ; may try other than 15 value
(= NewVel (+ VelVal (random (* -1 VelVar) VelVar)))
(= NewDur (+ DurVal (random (* -1 DurVar) DurVar)))
(= NewEve (+ EveVal (random (* -1 EveVar) EveVar)))
))
(+= Event.Time NewEve) ; Random Time Event
(= Note.Vel NewVel) ; Random velocity
(= Note.Dur NewDur) ; Random duration
(insert (- Event.Time 1) Channel WHEEL NewPitch) ; Random wheel
(= OldPitch NewPitch)
(= OldVel NewVel)
(= OldDur NewDur)
(= OldEve NewEve)
))
))
(insert Event.Time Channel WHEEL 0) ; Reset wheel on last note event
)
)
;; ---------------------------
Sorry for the lack of tabs, I could not preserved them in the thread...
SergeD
May be good to bring little variations on tracks.
;; ---------------------------
;; __Randomizer.Cal, by Serge Daigneault 2005
;; Insert random pitch, velocity, duration and event time
;; Be careful with Variation values. Values below 2 will conduct to and endless loop trap.
(do
(int PitchVar 6) ; Pitch variation may be changed
(int VelVar 5) ; Velocity variation may be changed
(int DurVar 10) ; Duration variation may be changed
(int EveVar 5) ; Event time variation may be changed
(int NoteVel 0) ; If NoteVel = 0 Note.Vel is used, otherwise NoteVel is used
(int NoteDur 0) ; If NoteDur = 0 Note.Dur is used, otherwise NoteDur is used
(int VelVal 0)
(int DurVal 0)
(int EveVal 0)
(int NewPitch 0)
(int OldPitch 0)
(int NewVel 0)
(int OldVel 0)
(int NewDur 0)
(int OldDur 0)
(int NewEve 0)
(int OldEve 0)
(int Channel 0)
(do
(forEachEvent
(do
(if (== Event.Kind NOTE)
(do
(= NewPitch OldPitch)
(= NewVel OldVel)
(= VelVal Note.Vel)
(if (> NoteVel 0) (= VelVal NoteVel)) ; instead of Note.Vel used
(= NewDur OldDur)
(= DurVal Note.Dur) ; or any constant number
(if (> NoteDur 0) (= DurVal NoteDur)) ; instead of Note.Dur used
(= NewEve OldEve)
(= Channel Event.Chan)
; Randomize pitch, velocity, duration and Time event. No repeating equal values ...
(while ( || ( || (|| (== NewPitch OldPitch) (== NewVel OldVel)) (== NewDur OldDur)) (== NewEve OldEve))
(do
(= NewPitch (* 15 (random (* -1 PitchVar) PitchVar))) ; may try other than 15 value
(= NewVel (+ VelVal (random (* -1 VelVar) VelVar)))
(= NewDur (+ DurVal (random (* -1 DurVar) DurVar)))
(= NewEve (+ EveVal (random (* -1 EveVar) EveVar)))
))
(+= Event.Time NewEve) ; Random Time Event
(= Note.Vel NewVel) ; Random velocity
(= Note.Dur NewDur) ; Random duration
(insert (- Event.Time 1) Channel WHEEL NewPitch) ; Random wheel
(= OldPitch NewPitch)
(= OldVel NewVel)
(= OldDur NewDur)
(= OldEve NewEve)
))
))
(insert Event.Time Channel WHEEL 0) ; Reset wheel on last note event
)
)
;; ---------------------------
Sorry for the lack of tabs, I could not preserved them in the thread...
SergeD