Noob: Odd MIDI latency issues in spite of latency = 0.0

I am using a MIDIFighter Twister controller with encoders and LED rings around its encoders.
I use a MIDIdef to call a MIDIOut to control which LEDs should be lit when turning an encoder. After starting the SC app (or after Reboot Interpreter), running the following code and turning the first encoder results in a significant lag (> 1 sec) between turning the encoder and seeing the LEDs react. IAC is active. It is not necessary for the scsynth to run.


~testvalue = 64;
~mf_out = MIDIOut.newByName("Midi Fighter Twister", "Midi Fighter Twister");
~mf_out.latency = 0.0;
~mf_out.control( 0, 0, ~testvalue ); // sets default value of LED ring
~mf_in_srcID = MIDIIn.findPort("Midi Fighter Twister", "Midi Fighter Twister").uid;
	\tester, {
		arg val, num, chan, src;
		~testvalue = (~testvalue + val - 64).clip(0, 127);
		~mf_out.control( 0 , 0, ~testvalue );
	ccNum: 0,
	chan: 0,
	srcID: ~mf_in_srcID,

One of the following will fix this latency:

  • After executing the code above, run just the lines
    MIDIClient.init; and
    again. Now the latency is gone until I restart the SC app or reboot the interpreter.
  • Have AMS, or MIDI Monitor, or GarageBand, or Logic open before starting SC. Once I ran the code above, I can quit the other app and still enjoy zero latency – until I restart the SC app or reboot the interpreter.
  • Disable IAC in AMS, in which case the latency is gone for good, but it also means I can no longer use IAC.

Please, what is causing this? Is this expected? Are there any other way to prevent this behavior? Thanks much in advance for any help!

P.S. SC version is 3.12.1, restarting the computer (MacBook Pro 2014 with 10.14.6) did not help.

P.P.S. The code above is quite useless on its own, but it allows to reproduce this issue, the code I am actually using does a bit more.

Update: Sorry, I was misled, disabling IAC in AMS does not make any difference.

The only remedy seems to be to either have another MIDI app open, or to execute MIDIClient.init and MIDIIn.connectAll again.

This is so odd and doesn’t make any sense. Any pointers are highly appreciated.

It’s probably this known bug:

Should be better in the next release. There might be a way to download a test build from github but I can’t find the link right now.


Thank you very much, I found the release candidate here. I tested it with both macOS 12.1 “Monterey” on a MacBook Air M1 from 2020, and with 10.14.6 “Mojave” on a MacBook Pro 15" from 2014, and the latency issue is gone :smiley:

I have read thru according bug #5622. Although it is already closed, does it make sense to add the information to it, that issue 1 (all MIDI messages are delayed approx. 2s after the first run of MIDIClient.init after SC starts; re-running MIDIClient.init removes that delay), does not appear if another app accessing the computer’s MIDI system is already running when starting SC? This happens reproducibly on both of my systems above.