Extreme delay from MIDI keyboard

Having trouble with LMMS? Ask about it here.
LMMS 1.1.3 on Arch Linux 4.18.5
Roland PC-200 MIDI keyboard through M-Audio MIDISPORT 4x4

Under Settings I have 3 choices: ALSA-Raw, OSS-Raw, and ALSA-Sequencer. The first 2 will always reset to Dummy and only the last one will survive a restart, so I have no choice on that.
I don't know if there is something to set up for ALSA-Sequencer.

When I press keys on the keyboard it will make sound in LMMS, but the events are delayed by about a minute and the events seems stretched out. I am new to LMMS and this is the first time I've connected the keyboard to the computer so I have no clue what could be wrong, but hopefully I am not the only one who has encountered this. Thanks for any advice.
I changed the output in Settings to go direct to hw:0,0 and for some reason it reduced the lag to 4 seconds. Puzzling, since I really think it's an input problem not an output problem because the on-screen keyboard for both TripleOscillator and ZynAddSubFX have no lag.

I installed kmidimon and observe that it also shows the 4 second delay and the appearance of the event there corresponds with the sound from the synth.
I ran this:
amidi -p hw:2,0,0 -d
and found that the events displayed there were also delayed (~4 seconds). When I press the keys, the lights on the MIDISPORT blink immediately, but then these events are reported with delay, and it's reading it directly from the USB port.

So I think the problem is not likely with LMMS but somewhere between the input of the MIDISPORT and the output of the Linux driver, or perhaps in ALSA.

I still hold hope someone reading this will have a clue for me.
First thing to try is the latest version of LMMS.

Easy to install because its an appimage. Download it, set it to be executable, and you're done.

https://lmms.io/download/#linux

If that fails it might be an idea to ask the defs on discord.
I installed lmms-beta which seems to be the latest but no difference.

What does "defs on discord" mean?
https://discordapp.com/

https://discordapp.com/channels/2035592 ... 6917085194

There are a few channels were you can talk to the developers of LMMS, maybe they can help.
jtgd wrote:
Tue Sep 04, 2018 10:20 pm
I installed lmms-beta which seems to be the latest but no difference.
LMMS-beta?
This one:
https://github.com/LMMS/lmms/releases/d ... 4.AppImage

If not you should try that.
The instruction to connect midi-kb is here:
https://lmms.io/wiki/index.php?title=Using_MIDI
Have you gone through that?

Besides that, since you are new in Forum
Welcome jtgd !
Here are all important links:
http://lmms.io/forum/viewtopic.php?f=1&t=4740
-A few rules and useful forum instructions
musikbear wrote:
Wed Sep 05, 2018 10:30 pm
jtgd wrote:
Tue Sep 04, 2018 10:20 pm
I installed lmms-beta which seems to be the latest but no difference.
LMMS-beta?
This one:
https://github.com/LMMS/lmms/releases/d ... 4.AppImage
If not you should try that.
In the Arch repository I had these choices:
  • aur/lmms-beta 1.2.0_rc6-3 Beta version of the Linux MultiMedia Studio.
  • aur/lmms-beta-bin 1.2.0_rc6-4 (Installed) Beta version of the Linux MultiMedia Studio.
  • community/lmms 1.1.3-4 (Installed) The Linux MultiMedia Studio.
Since the lmms-beta matched the version number in your link I assume it is the same.
I preferred the Arch install over the manual install since it will be updated automatically.
The instruction to connect midi-kb is here:
https://lmms.io/wiki/index.php?title=Using_MIDI
Have you gone through that?
Yes, that's where I started.

As I said above, the delay is apparent in kmidimon so I suspect the delay precedes LMMS. I'm hoping someone familiar with LMMS has encountered a similar problem.
Besides that, since you are new in Forum
Welcome jtgd !
Here are all important links:
http://lmms.io/forum/viewtopic.php?f=1&t=4740
-A few rules and useful forum instructions
Thanks! I hope I did it right. If not let me know.
jtgd wrote:
Thu Sep 06, 2018 3:19 am
I hope I did it right. If not let me know.
No, i recommend you to remove what you have now, and install the App-image. Not only is that the best option, its also the one that is being fail-checked in our tracker.
Forget about using various repository versions, often they are for specific tests, and some are not complete
musikbear wrote:
Thu Sep 06, 2018 10:03 am
jtgd wrote:
Thu Sep 06, 2018 3:19 am
I hope I did it right. If not let me know.
No, i recommend you to remove what you have now, and install the App-image. Not only is that the best option, its also the one that is being fail-checked in our tracker.
Forget about using various repository versions, often they are for specific tests, and some are not complete
Thanks for the tip. I did as you suggested and downloaded that .AppImage file and it turns out it's binary identical to the one from lmms-beta.

I may have found the problem though. From another post somewhere it was suggested that I unplug-replug the USB cable to the MIDISPORT. I tried that and restarted LMMS and it did seem to cure the delay problem on first try. I need to do more prolonged testing but maybe that is indeed the fix. My guess is that somehow the USB driver/buffer gets clogged and that resets it.