The script I wrote is pretty stupid - meaning there is not much logic involved. It only directly applied to the original question you had posed.
It does not care anything whatsoever about 'range', and literally only blindly sets anything found above the entered input value to that value. This is why those last 10 events would all be set to a flat line.
I understand that you get a flat line for whatever events are found in excess of the value you input, but do not understand from your comment "
Is it possible to maintain the crescendo shape by beginning the data at -10 so only the last 90 count? ".
It is easy enough to alter the script, but I need to better understand how you want the values changed.
Here is the current logic of the script:
1. Get an input value from the user, that will represent the maximum allowable mod wheel level.
2. Loop through all events for the selected midi track, with the following applied to every event.
3. IF event is a Controller event, of type '1' (standard mod wheel CC), AND the level exceeds the input level entered by the user, set the mod wheel event level to that of the input level.
That's it. That's all it does.
So, I am happy to change this to try to fit whatever your needs are - I just need to better understand what exactly you need it to do.
As it stands now, any curve that is in place up to the max allowable level that you input is preserved, since the script does not operate on any event that has a mod wheel level value that is less than that input value.
Let's examine a scenario, for the last 15 events of mod wheel event data for a given midi track, so here are the levels for those 15 events, before processing the script:
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
OK, so the above is a nice smooth curve. After processing the script, with you inputting a maximum allowable level of 98, you end up with:
90 91 92 93 94 95 96 97 98 98 98 98 98 98 98
This is per the original spec to which the script was written.
Please list for me how you would rather see the data look after processing, starting from the original list prior to processing. I will cheerfully make whatever adjustments you need.
It almost seems like what you are looking for is a general alteration of the whole SCALE of the level, across its entire range. If so, I am not sure how I would accomplish that, since the levels appear to only be whole number values, and a scale redefinition would seem to me to require fractional values for some of the calculated percentages.
Again, if you could list the level values you would like to see - using the events from the 1st set I posted above as the starting point(90-114), I can change the script to try to accommodate that.
Thanks,
Bob Bone