DodgyJammers / jammypiece

0 stars 0 forks source link

Massive latency with simple pipeline #5

Closed arr28 closed 9 years ago

arr28 commented 9 years ago

Even with a simple pipeline that's doing almost no processing, there's a massive (250ms+?) latency between pressing a note on the keyboard and hearing it via the synth.

arr28 commented 9 years ago

http://www.sibeliusblog.com/tips/taming-the-flexi-time-latency-beast/ may help.

arr28 commented 9 years ago

Actually, the latency was more like 500ms. However, by using the OS synth (Microsoft MIDI Mapper Windows MIDI_MAPPER) instead of the Java synth (OpenJDK Gervill Software MIDI Synthesizer), I've got that down to ~250ms.

I wonder where the latency is occurring.

arr28 commented 9 years ago

Hmm, well this is looking bad. I gather (from MF & KSW) that the reviews say that the Roland UM-ONE is the best MIDI -> USB converter around, in terms of latency. However, I've definitely got a latency issue here and it's somewhere during the input stage.

The pipeline is...

Keyboard -> USB Dongle -> USB port -> jammypiece in -> jammypiece out -> OS Synth -> headphones

So, the problem lies somewhere between the Roland device receiving the MIDI input and jammypiece receiving the same. I've tried (a) switching off my VM, which sometimes interferes with this sort of thing and (b) using a different USB port. If I squint at it funny, I can almost convince myself that the latter helped. But really, it's still a big issue.


I'd like to try with somebody else's PC. Also, if any of you have a MacBook or laptop running Linux, I'd definitely be interested to try that too.

Or maybe we need to get a serial connector after all. No idea what drivers might be required to present that as a MIDI interface and whether it would actually help.

kw217 commented 9 years ago

Easiest solution might be to develop on Linux rather than Windows. I set up the Roland UM-ONE mk2 and "rosegarden" (a MIDI editor) on my Ubuntu workstation at home, and connected it up to my Yamaha NP-31. With rosegarden set to loop MIDI back out to the device, but the device also playing on each key, I couldn't detect the latency - the two notes were sounding near-simultaneously.

However I've not tried with jammypiece yet - if Java has issues, that would still be a problem.

rgefryer commented 9 years ago

My previous MIDI processing has been in C on a 386sx DOS PC, then on a PalmPilot, and had no detectable latency. Any latency will be a killer.

Just one thought - for a bit of fun, we could implement on a Raspberry Pi, the idea being that it might end up as being a standalone piece of hardware.

arr28 commented 9 years ago

Phew. As it transpires, it was output latency after all. I was misled because the logging path also had high latency.

Sending the MIDI back out to a hardware synth solves the problem. (There may also be lower latency soft synths and/or asio4all.)