Linux

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Wed Jun 22, 2022 6:25 pm

Latency is 10.9ms in my setup. That's drumstick click over the snare to audio from headphones measured with an external microphone.

Frame rate latency: 8ms
64 sample audio buffer latency: 1.5ms
mystery latency: 1.4ms

But I just realised that my headphones may have been connected to a usb dock. And that could very well explain the mystery latency.

The other thing I discovered is that with a buffer size of 100 samples, pulseaudio plays without any issues. At least on my machine. That's 2.3ms of latency vs 1.5ms. But it offers the convenience of using pulse audio and that means playing system sounds in the background. That may be something you want or not.

There was a hack I saw on the forums of increasing the camera rate to 187 fps. If that were used, the additional audio latency could be compensated for at the expense of some increased cpu usage. Maybe not the best deal.

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Mon Jun 27, 2022 7:39 pm

It turns out I wasn't measuring latency before. The way I was hitting the sticks together was creating a double impact. The real audio came a lot later. Like 100ms later. I didn't realise this until I spent some time playing.

To fix the measurement I need to hold one of the sticks down on my leg. Striking in the air caused the bottom stick to rebound upward. I also turned up the snare sensitivity and volume so that I don't have to hit the sticks together so hard.

The fix for latency was to install wineasio and jackd. The minimum usable latency on my system is 128 (2.9ms) and to get down to 64 I think I need a realtime kernel. I may play with that later.

Total latency now is 15-18ms. Which is much better, but still seems too high. I haven't measured the latency in windows yet so I don't know how it compares. And I haven't had a chance to play aerodrums like this.

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Tue Jun 28, 2022 5:34 am

So the latency on windows is less than wineasio.
latency.png
latency.png (46.2 KiB) Viewed 2427 times
The above picture shows how I measure the latency. The top waveform, alsa-latency, is a very large latency. There is a vertical line indicating where the snare audio starts and you can see the stick click on the left hand side.

I isolated the stick click+snare sample by cutting it out of a longer recording. I aligned the stick click for all 3 waveforms.

alsa-latency: 5708 samples (119ms)
windows-latency: 823 samples (17.1 ms) (64 sample buffer)
wineasio-latency: 1123 samples (23.4 ms) (128 sample buffer)

I don't know if there is a better way to measure the latency. I'm open to suggestions.

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Tue Jun 28, 2022 5:36 am

Here I attached the audio clips that generated the waveforms in the previous post.
Attachments
wineasio-latency.mp3
(18.42 KiB) Downloaded 114 times
windows-latency.mp3
(18.42 KiB) Downloaded 113 times
alsa-latency.mp3
(18.42 KiB) Downloaded 114 times

Sipaliwini
Posts: 426
Joined: Thu Jan 16, 2014 12:40 pm

Re: Linux

Post by Sipaliwini » Tue Jun 28, 2022 9:55 am

Thank you for doing more work on this.

Yes this is a good way to measure latency.

15-18ms is not ideal but it is definitely good enough to play without it being distracting. Of course it is much more than an acoustic set, but for example it is a bit less than depressing an acoustic piano key softly.

I don't believe you need a real time kernel to lower the minimum audio buffer size, I think you just need to lower some constants when re-compiling the kernel.

It would be good to try and get it at least as good as your Windows reading, it should be possible.

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Tue Jun 28, 2022 5:51 pm

I did see 15-18ms with wineasio at some point, but I didn't save that recording. I'm not sure what is creating that variability because the recording I did save shows higher latency. I'd have to do a lot more testing to confirm the results I'm seeing and honestly I have no interest in doing that. I have no control over the biggest piece of this machine (ie. wine).

I can't easily recompile my kernel (it's an oem kernel) and I am loathe to change it because prior to finding this kernel my system would randomly lock up hard. Not good times.

I'll see what kernel parameters are in my kernel and if any can be used to improve latency. My goal is to run jack at 64 samples.

elloh
Posts: 5
Joined: Tue Mar 30, 2021 2:27 pm

Re: Linux

Post by elloh » Fri Jul 15, 2022 8:55 pm

Hello,

I tried to follow the howto.

But i had no success.

The wine-stable branch for winehq is now 7.0.0 for focal.

The lib usb compiled succesfully with the patch and i could install it using sudo make install.

But aerodrums does not find the camera either even if i blacklisted the linux camera driver ... (I installed aerodrums using wine64).

I even installed wineasio using kxstudio repository in order to have ASIO capabilities. But for now, i'm stuck with the camera driver.

Any idea ?

InTheWorks
Posts: 20
Joined: Sat May 28, 2022 11:59 pm

Re: Linux

Post by InTheWorks » Sat Jul 16, 2022 3:12 am

You can try to install a specific wine version. First uninstall what you have installed. Then try:

Code: Select all

sudo apt-get install wine=5.0-3ubuntu1
In the terminal you can type up to the equal sign and then press tab. It should give you a list of versions.

I did try wine-staging from the repos and it installed 7.x and I couldn't get it to work. So it looks like wine 7.x won't work without further changes (if at all).

Post Reply