What's new

True legato script with speed detection

FredW

Member
Hey,

I have created some true legato Sampler (EXS24) instruments in Logic and thought it would also be fun to make the transitions a bit more adaptive using a speed detection script. I am trying to figure out what would be the preferable (most accurate) way to detect timing from incoming MIDI notes to adjust legato groups?

Currently I am using the “JavaScript Date().getTime()” method in Scripter to detect the playing speed and automatically adjust the legato groups in Sampler. It works somewhat fine, but not super accurate during fast passages. I was thinking if it’s possible to use Logic’s clock for better calculation, or is there perhaps any other script method I should try?

Thanks
 
Last edited:
I wish I could help because this sounds very interesting, but I sadly don't know enough about this... It sounds cool though, it would give Sampler abilities that only seemed possible in Kontakt... 😊 Perhaps @Dewdman42 or @charlieclouser can help?
 
I wish I could help because this sounds very interesting, but I sadly don't know enough about this... It sounds cool though, it would give Sampler abilities that only seemed possible in Kontakt... 😊 Perhaps @Dewdman42 or @charlieclouser can help?
Thanks for pointing to the Sampler gurus, although the script is doing what I want now. Was a bit confused first because I tested the script on a resampled legato string library that has an overall slow attack, so the fast legato passages sounded a bit weird (also in the Kontakt version). I’ve seen the GetTimingInfo(); method being used for other scripts, but then Logic must be in playing mode to get the timing between the notes. So the other method works better I think...
 
Scripter does all of its processing ahead of time and in a non-real-time manner. So when you use the JavaScript Date function, that is using time stamps at the moment in time when the actual processing occurs rather then based on the timestamps of the notes placed on them by CoreMidi. That will not be even close to accurate other then crudely approximate.

The proper and sample accurate way to detect timings in scripter is to use NeedsTimingInfo so that all midi events will have a beatPos attribute, which is a sample accurate fractional beat value as determined by either CoreMidi when the midi event comes into the Midi interface or saved in the logicpro midi region.

This value is present even when the transport is not playing, but while it’s stopped the running beat positions will have no correlation to the actual transport. When you press play the beatPosition resets to match the transport. When you press stop it keeps running the beat position as if it were playing. So you can still detect timing even while stopped.

If you need to use something like ms as your method of timing measurement, then you have to use GetTimingInfo to obtain the current tempo setting and calculate that from the beatPos value
 
Last edited:
Scripter does all of its processing ahead of time and in a non-real-time manner. So when you use the JavaScript Date function, that is using time stamps at the moment in time when the actual processing occurs rather then based on the timestamps of the notes placed on them by CoreMidi. That will not be even close to accurate other then crudely approximate.

The proper and sample accurate way to detect timings in scripter is to use NeedsTimingInfo so that all midi events will have a beatPos attribute, which is a sample accurate fractional beat value as determined by either CoreMidi when the midi event comes into the Midi interface or saved in the logicpro midi region.

This value is present even when the transport is not playing, but while it’s stopped the running beat positions will have no correlation to the actual transport. When you press play the beatPosition resets to match the transport. When you press stop it keeps running the beat position as if it were playing. So you can still detect timing even while stopped.

If you need to use something like ms as your method of timing measurement, then you have to use GetTimingInfo to obtain the current tempo setting and calculate that from the beatPos value
thank you!

Didn't know it was possible to use beatPos when not in play mode but just tried and it worked great! Possible to get float numbers out of event.beatPos? Now the output quantize to quarter notes.

Good idea converting it to ms also. I will try that.
 
@FredW Glad to hear you could get it to work :). Any chance you might want to share your script with your fellow Sampler enthusiasts? I'm really curious about the result: would love to hear a demo :)
 
@FredW Glad to hear you could get it to work :). Any chance you might want to share your script with your fellow Sampler enthusiasts? I'm really curious about the result: would love to hear a demo :)
Absolutely, that is the idea. I also have to make a quick walkthrough showing the leg group mapping inside Sampler for the script to make sense I guess.

I have only tried this script with a commercial resampled library so far, to replicate the Kontakt version. Not sure I can upload an audio demo of a resampled library here. It goes against EULA no? Maybe I'll record a small dummy instrument just for demonstration...
 
Absolutely, that is the idea. I also have to make a quick walkthrough showing the leg group mapping inside Sampler for the script to make sense I guess.

I have only tried this script with a commercial resampled library so far, to replicate the Kontakt version. Not sure I can upload an audio demo of a resampled library here. It goes against EULA no? Maybe I'll record a small dummy instrument just for demonstration...
Would love to hear/see/learn it too :)
 
Absolutely, that is the idea. I also have to make a quick walkthrough showing the leg group mapping inside Sampler for the script to make sense I guess.

I have only tried this script with a commercial resampled library so far, to replicate the Kontakt version. Not sure I can upload an audio demo of a resampled library here. It goes against EULA no? Maybe I'll record a small dummy instrument just for demonstration...
@FredW Really kind that you want to do that. I totally understand and I think you're right. Perhaps you have some other Sampler instruments you made and sampled yourself (not that commercial resampled one) that you can use to demonstrate the script's sound and functionality? Because the script is mainly of interest 😊
 
Top Bottom