MIDI problem

JesterN's icon

Hi guys I have this Sampler I made using some old code. There is a part in which I just take the last 10 seconds of audio that just happened (which are always writtenin a circular buffer). For some reason when I click with my mouse it's fine. When I click with a midi controller or key (in Ableton) it does some strange stuff. I checked for not off notes on but I can't explain it's just different. Anybody can help? It's labelled "Snapshot" in presentation mode. I really need it from a controller and not with the mouse.,,, Code attached

Sampler.zip
application/zip 18.40 KB

broc's icon

Different behaviour of mouse vs. controller action usually happens because the events have different priority (low vs. high). Inserting [deferlow] in the controller input may help, but introduces latency. You are using some JS code which is generally not suited for real-time processing (as it runs at low priority). So perhaps it can't properly handle the high priority events from the controller.

Source Audio's icon

Overdrive must be on for midi
use clearlow instead of clear to wipe buffer.
Check all that pipes and priorities.
Get rid of java
....

JesterN's icon

Hi guys thanks that solved the problem! I just don't understand deferlow and overdrive, should it be always used in the case of MIDI?

broc's icon

This article may be helpful.
https://cycling74.com/articles/event-priority-in-max-scheduler-vs-queue

Source Audio's icon

Overdrive on is a must when using midi.
Even so, it can happen that high cpu usage might put midi into
unusable state, resulting in terrible lag, on osx in first place.
Turning overdrive off, and on usually fixes the problem.
One can make a "resetter" by triggering overdrive off, and than on after 100 ms or so.


clear message to buffer is executed in high priority and will disturb
whatever is in exec cue.
clearlow is "nice" meaning relaxed priority.