A technical support community for Apple Logic Pro users.

 
User avatar
Dewdman42
Posts: 2804
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Slew/Glide for Aftertouch/Midi CC

Thu Oct 15, 2020 6:55 pm

here's a very simple brief example

var NeedsTimingInfo = true;

var currentLevel = 0;
var lastBeat = 0;
var GAP = 0.00625;   // approx 12.5ms at 120bpm

function HandleMIDI(event) {

    // Check for AT event
    if(event instanceof ChannelPressure) {
        let info = GetTimingInfo();
        currentLevel = event.value;
        lastBeat = event.beatPos;
    }
   
    event.send();
}

var at = new ChannelPressure;
at.channel = 1;

function ProcessMIDI() {

    let info = GetTimingInfo();
   
    if(info.blockStartBeat > lastBeat + GAP) {
       
        if(currentLevel > 0) {
            currentLevel--
            at.value = currentLevel;
            at.send();
            lastBeat = info.blockStartBeat;
        }
    }
}


the above only works for midi channel 1. It will have to be more complicated if you want to track more then one midi channel at the same time. But anyway, the list is...when you play some AT from your keyboard...it will be sent thru and then each process-block later we check to see if approx 12.5ms has gone by (at 120BPM) and each time it has, then send another AT event that is 1 value lower then the previous, etc..and do that every 12.5ms until it reaches zero or unless another AT is received then jump to that value and keep going.

Its just a simple example so you can see how to catch time passing by and send out stuff. It can get more complicated if you are trying to be more precise or handle multiple midi channels among other things, but that should get you started.
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.5, Mainstage3, Cubase10.5, StudioOne4, Reaper, DP10, VEP7, VSL, too many plugins to list
 
DGB111
Posts: 21
Joined: Sun Apr 02, 2017 2:36 pm

Re: Slew/Glide for Aftertouch/Midi CC

Fri Oct 16, 2020 12:20 pm

Thanks so much!!

The problem I've found with AT is that it actually doesn't throw enough data. Like a push can jump from 0-30-70, so scaling it can only do so much as far as smoothing it out. What I've found is needed is multiplying the info (like making a loop to create the data from 0-30) but that data needs to be spread out in time, which would really need some kind of wait before executing ability. Which is a bummer that the scripter doesn't really have (as far as I understand).

Its for a project I'm working on so I'll keep poking away at it. Lot's of things I've tried have gotten me almost there. Hopefully it'll all come together in something useable : )
 
User avatar
Dewdman42
Posts: 2804
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Slew/Glide for Aftertouch/Midi CC

Fri Oct 16, 2020 12:32 pm

I just gave you an example script for how to spread out events over time. Study that and try some things. Otherwise you will have to be much more specific about what you are trying to accomplish for further ideas.
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.5, Mainstage3, Cubase10.5, StudioOne4, Reaper, DP10, VEP7, VSL, too many plugins to list
 
DGB111
Posts: 21
Joined: Sun Apr 02, 2017 2:36 pm

Re: Slew/Glide for Aftertouch/Midi CC

Fri Oct 16, 2020 12:45 pm

Thanks, I must not have looked close enough! will poke around more : )