Lag when period size required by driver is larger than requested
Micksa opened this issue · comments
I have a setup where I route all audio through jack. As such I use the alsa jack plugin to get alsa apps to use it for audio output.
I was trying to "play" munt via a midi keyboard and found that I was unable to make the latency acceptable. Whatever settings I gave it seemed to get multiplied by some factor - attempting to force a latency of 40ms gave an actual latency of ~300ms. This was happening in both the cmdline prog mt32d and with mt32emu-qt.
I added some code to dump alsa hw params and found that the actual period size used, as returned by snd_pcm_hw_params_get_period_time, was ~5ms. This was correct given I had selected a period size of 256 frames at 48000Hz in jackd.
However the code appears to ask for a period size of ~0.7ms and assumes it gets what it asks for. Also it looks like the buffer size calculations assume a period size, so when it is not what is expected, the effect is that the latency is not what is asked for.
Hmm, "a period size of ~0.7ms" qualifies a low latency. Anyway, I have no idea where this comes from. mt32emu-qt by itself does NOT configure JACK buffer size.
@Micksa Have you succeed in identifying the component that adds unwanted latency in your setup?
Timeout awaiting for the response. Closing this as likely being specific to the system configuration and lack of detail necessary to investigate.