quattj Posted yesterday at 06:16 PM Posted yesterday at 06:16 PM A user over at midi.org (and here as well I believe) created a CAL script for me several years ago to fade out the end of a midi file. It works by inserting "dummy" controllers (#12) and then combines them with any existing expression controllers (#11) to fade the file out. Up to now this has worked very well. However, with the current soundtrack I am working on, every channel MIDI 1-8 plays every instrument, alternating one note at a time. Similarly, every channel 9-16 plays percussion, again alternating every percussion one note at a time. There are 8 individual tracks for each instrument. I believe the issue I am having is that the inserted controllers are affecting the channels when they are not currently on the "active" track for that channel. I can't really wrap my head around half of what the script is doing internally. I can program in C languages just fine, but CAL script just look like gobbledygook to me. 😅 The midi.org forums have been essentially dead since the forum was changed over to new software last(?) year, so hoping to get a quicker response here. *** Essentially, what I would like to have the script modified to ONLY keep the expression controllers where they originally exist, but have them at the newly set level. *** As the script works right now, all of the new controllers remain and continue fading from the last level they encountered. This means if there were none to begin with, you would see a straight line in an expression viewer all the way from 127 down to 0. If there were already expression values, you would see the line go down but where any values already existed, it jumps to that percentage of the modified value, meaning it might go down and then up again. Here are a series of captures from the expression view in Sekaiju to show what I mean. Each of the first 3 images are different percussion instruments and their resulting final expression values after running the script. The fourth image is the combined overlay of how they appear when the file is played. You can see the individually, the expression would work well as a fade out, but when combined they are "destroyed" by the track that had no expression to begin with, and therefore has the full 127 to 0 fadeout.  _expression-fadeout.cal
quattj Posted 1 hour ago Author Posted 1 hour ago I've been reading a CAL guide, and it seems CAL is very similar to LISP, a language I hated and have since purged from my memory 😜 That being said, I went through the script and rewrote it in a C-like language so I could process what was happening. I have now commented out this line     ;(= Control.Num TARGET_CONTROLLER) which stops the added in #12 controllers from being converted to #11 controllers. The section that follows then still sets the existing #11 controllers to the correct values, thereby eliminating all of the extra overlapping controllers added with the script. Now I have a bunch of leftover #12 controllers, and need to delete them at the end of the script. I was looking at (EditCut [<from> <thru> <events> <filt> <tempos> <meters> <markers> <hole>]) but if I understand correctly, this can not be restricted to a specific controller? Unless there is some way to assign #12 to the active filters? Every parameter after "<thru>" is a boolean, so <filt> is either TRUE or FALSE to use filters.
Promidi Posted 33 minutes ago Posted 33 minutes ago 1 hour ago, quattj said: (EditCut [<from> <thru> <events> <filt> <tempos> <meters> <markers> <hole>]) but if I understand correctly, this can not be restricted to a specific controller? Unless there is some way to assign #12 to the active filters? Every parameter after "<thru>" is a boolean, so <filt> is either TRUE or FALSE to use filters. Maybe use a ForEachEvent Loop do delete just CC12 events. (forEachEvent (if (&& (== Event.Kind CONTROL) (== Control.Num 12)) (delete))) For the whole fade out thing, I just use a script I have written that creates a fade out by progressively reduces the controller values of selected controllers while keeping the relative dynamics. This effects all selected controller and aftertouch event though, but I am sure it can be modified to just effect CC11 events. I think the lines you would need to change is: (if (|| (|| (== Event.Kind CONTROL) (== Event.Kind CHANAFT)) (== Event.Kind KEYAFT)) to (if (&& (== Event.Kind CONTROL) (== Control.Num 11)) You could probably think of ways to trim this script even further. Fade Out Controllers.CAL
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now