High Latency of Midi Notes going between Ableton and Max

Jetski's icon

I am trying to create a MFL instrument that uses a groove~ object to play back samples. I want to trigger sample playback by playing a note on a midi keyboard, so I've set up my Max patch so that when a midi note-on message is received, the groove~ starts playing back a sample, and then when a note-off is received, the playback stops. I've tested the patch and it works, and I'm not trying to play more than one note at a time for now, so this setup works for my needs.

However, the problem is that there is a very high latency. When I play a midi note in Live, there is a very noticeable lag before the sample starts playing back. I would really like to use this patch but right now it's too laggy to be useable. Does anyone have any tips for reducing latency of the patch? Thanks in advance for any help! I have pasted the patch at the bottom of this post.

I have Ableton's buffer size set to 512 samples already, so that doesn't help much. I'm running a 2014 Macbook Pro with a 2 Ghz Inter Core i7, 8 GB RAM, and a 250 GB Solid State Drive. Does anyone know if more RAM could possibly help reduce latency in this situation? I am very open to buying replacement parts for my computer if it could help. Also, my hard drive is very full (only about 3 GB free right now), so maybe I'll try clearing some space to see if it makes any difference. Btw I know almost nothing about computer hardware, so excuse my ignorance if I'm approaching this wrong.

Also, I know I could easily play back samples using Ableton's Sampler or Simpler instruments, but I specifically want to use Max For Live so that I can use Devin Kerr's Free Elastic Pitch/Speed Object. This allows me to independently alter the pitch and speed of a sample while it's being played back, which I can't really easily do using Ableton's samplers. But if anyone has any other recommendations for a method of live-adjusting both pitch and speed independently, please let me know!

Max Patch
Copy patch and select New From Clipboard in Max.

Max Gardener's icon

Devin Kerr's stuff has (or had, last time I looked) some serious latency problems on its own.

Jetski's icon

Ah ok, I had considered that his subpatch could be contributing to the lag — I don't really understand the inner workings of his patch since I'm fairly new to Max, do you know if there's a specific part of it that could be slowing things down?

Does anyone know where I could purchase Simon Adock's Elastic object (as seen here)? The link www.elasticmax.co.uk seems to be down...

Source Audio's icon

No need for 3rd party externals for buffer playback with adjustable speed/pitch.
Groove from max 7 upwards can do that or ?
I have elastic object...
There were also elasticx and some other variants, but none
of them was based on elastic's algo and were sounding just like tapin/out
based shifters.
Elastic did sound ok, but it is VERY BUGGY, crashing
whenever one changed buffers, set mode to record etc.
I can't recommend it, definitely not for on stage use,
also it has some really stupid copy protection schema inside,
building standalone with it made me crazy, I had to authorise
it on the fly by using some scripts, but at the end abandoned it
due to unreliability

Jetski's icon

Oh that's great! I have Max 7 but I didn't realize that groove~ by itself has speed and pitch adjustment. I did see that the elastic object was 10 years old, so that makes sense that Max has caught up to it by now.

I'll try using just the groove~ object later tonight and see if the latency is improved.

Jetski's icon

Great news -- I removed the third-party external and instead just used a groove~ object by itself, and the problem was resolved! The latency is now negligible, so I can use a midi keyboard to trigger playback of the groove~ object and it feels responsive enough to play like an instrument. I'm also using a midi controller to adjust the pitch and speed of groove~ and it sounds great.

Thanks Source Audio for the tip!