Jump to content

advanced humanization via CAL script


timeworx

Recommended Posts

Greetings all - 

I compose a lot of MIDI music and use CAL scripts for humanization regularly.  One complication I encounter that requires manual editing is with regard to note duratino and overlap with subsequent notes. Much of my MIDI articulation requires note overlap in order for the articulation to work (legato, hammer-ons etc.)

When using CAL scripts, even with duration adjustments, some of the overlaps are lost (or inadvertantly added). If there is a way to capture EVENT.TIME in an array, I could cusomize code to address this. Is anyone familiar enough with the scripting language to know if this is possible?

Link to comment
Share on other sites

I've written a few CALs. It's kind of like LISP and not for the faint at heart. I don't recall there being an array feature. 

I'm guessing you are in part changing the start times of the notes to "humanize" them. If it were a single line (with no keyswitches) a CAL script could maintain the overlap by lengthening an advanced note, and lengthening the note preceding a delayed note, both by the amount that you shift the "current" note, for notes that originally overlap. You wouldn't need an array for this. You'd need to save a reference to the modified note event when you move to the next one so you could refer back to it.

If you have keyswitches that need to precede or follow a note for hammer-ons, slides,  voice changes, etc. (like Ample guitars for example), you may need to correct those manually so that they move relative to the notes they are intended to affect. There would also be a much more complex issue with polyphonic passages where overlaps are all over the place.

I'm two-blocked now with other programming but if I get a chance, I'll try to do this.

Link to comment
Share on other sites

The problem with this is that the events within the range are not acquired on time.
For example, even if "CDEFGAB" is selected, CAL may process in the order like "ECDBGFA".

Measures in my case.
There is no array in CAL. Therefore, create the necessary variables, get the information within the range, and create an array.
Variables can be easily understood by using "array.time00, array.time01, array.key00, array.key01, ..." and so on.
Arrays can be sorted by performing the necessary comparison processing using "while, switch", etc.
By executing (forEachEvent) again and comparing the event information with the array, legato processing etc. can be freely performed.

As a premise, knowledge of programming that can create arrays and sorts is required at a minimum.
It is quite difficult because it is necessary to customize the array processing, especially the comparison processing, for each Cal.
Of course, once you make it, the rest will be easier.

I haven't processed the chords correctly yet.
I would like to know if there is an easier way.

Link to comment
Share on other sites

  • 1 year later...

Late to the party. I just happened to stumble on this while searching for something else. FWIW, I have written CALs where the modification of an event depends on some parameter of the one before it - or vice versa. Like billp, I have just had to save the the parameter(s) of the one event for use in processing the preceding/following event on the next iteration of the loop. I don't fully understand the issue you have with the order of notes in a chord, but it sounds like you would just need to check for simultaneity of start times (maybe within some user-specified number of ticks if chords aren't hard-quantized) and save the necessary paremeters of several events in a row to be used on the next pass.

Bottom line, there is no way to store the infromation in an array. You have to create a sort of facsimile of an array using indexed variables like lastChord1, lastChord2, lastChord3 , etc.

  • Like 1
Link to comment
Share on other sites

i sometimes use the CSHumanize MidiFX Plugin but only for minor velocity changes. i find the timing bits feel too coarse even in small amounts, so for the timing bits i'll either adjust by hand or use the normal quantize tools. 

it would be really nice if the new CAL was based on Javascript-like scripting so blocks can be explicit, full array, object, and prototype support etc versus depending on the indentation models used in other languages... lol you could then write proper text-formated "libraries" for controlling not only the app but plugins etc...

Edited by Glenn Stanton
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...