Dolphin, the GameCube and Wii emulator - Forums

Full Version: Test results for audio input lag in Dolphin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have been testing video input lag for Super Smash Bros. Melee for quite some time now, but until recently I never took any tests of the audio lag. I have searched the forums on post findings, however the few older threads I found were on very old Dolphin versions and didn't say much about how they tested the lag. They were also focused on audio-video sync, so perhaps the setups used just had more video input lag than the ones I used, so that the offset of audio was decreased.

I think that for emulation validity, it's important that there is no additional input lag over console, both for video and for audio. Because of this, I didn't want to just test audio sync by measuring audio against video, but to test audio and video input lag by comparing both of them to the button input signal, all connected to a 4-channel oscilloscope.

My testing results are here: http://kadano.net/SSBM/inputlag/audio.html


To give a short tl;dr: On console, the average video input lag is 67 ms on average and the average audio input lag is 36 ms. I took 80 samples to calculate these averages, so they should be fairly accurate.

On Dolphin 5.0 with Direct3D11 and the XAudio2 backend (0 buffer), the average video input lag is 48 ms on average and the average audio input lag is 162 ms.

The 162 ms I got on a PC with an Asus Xonar DG sound card in direct mode with all sound effects disabled. Noteworthy is that the integrated Via audio of a different PC was considerably faster.
On the Via audio PC, I've only tested the Ishiiruka Dolphin build configured for Melee netplay ("FM4.9") yet. The fastest averages I got there for the audio input lag were 103 ms. Note that for many of the emulation series, I only took 10 samples when I noticed that audio lag was >90 ms, since I consider that amount far too much for serious play, so I don't think there is merit in finding out whether it's 10 ms more or less for a certain configuration.

The purpose of this thread is raising awareness about the audio lag problem, finding out more about this audio lag, what it's caused by and how to decrease it. I do not rule out the possibility that this amount of audio lag is not present on all Dolphin setups, however I ask that people who claim so provide details about their setup so I can replicate it and test the audio lag for it.
It would be nice if you could test the OpenAL backend with hardware X-Fi cards as it has direct access to the hardware, but sadly the only card that I am sure that works correctly with Windows 10 is the Titanium HD, which is not cheap...

You can also edit OpenAL Soft's config file to reduce buffering, and hopefully the delay. There is a nice GUI from its dev, if you are interested.
(05-04-2017, 11:22 PM)LAGonauta Wrote: [ -> ]It would be nice if you could test the OpenAL backend with hardware X-Fi cards as it has direct access to the hardware, but sadly the only card that I am sure that works correctly with Windows 10 is the Titanium HD, which is not cheap...

You can also edit OpenAL Soft's config file to reduce buffering, and hopefully the delay. There is a nice GUI from its dev, if you are interested.

This one here? https://www.willhaben.at/iad/kaufen-und-...199655278/
I should be able to get it for 20€ including shipment, that will be okay. Can you help me setting it up properly? I have barely any experience with audio, so if you could tell me how to configure the X-Fi driver backend, that would be great.
Edit: I bought that card.

Do you have a link or other reference for editing the OpenAL Soft config file?
You can download the newest binary for OpenAL Soft here:
http://www.openal-soft.org/openal-binari....2-bin.zip

The config utility is inside the alsoft-config folder, it saves the file to your %AppData% folder. I like to use it with 128 period samples (samples per buffer) and 3 periods counts (buffers).

Sure, I can help you set it up properly. But I couldn't see which model you bought as the link is invalid now. Can you send me a picture or the model later?
Sorry for the double post, but I just tested with my X-Fi by recording the sound of the keypress (I am using a keyboard) and the speaker using the same microphone, and both sound sources are the same distance from the mic. I record the sound using Audacity and compare the beginning of my keypress with the beginning of Dolphin's sound output.

I am not getting the same results as Kadano or MayImilae on the progress report, but they are consistent.

With Cubeb I am getting 100 ms, with XAudio2 120ms, with OpenAL Soft (latency set to 15 ms) 120 ms, with OpenAL Soft (latency set to 20 ms) 150 ms and with a X-Fi's OpenAL (latency set to 6 ms) 70 ms.
I would be great if Kadano could test the X-Fi with his setup.

I tried to circumvent the buffer in the Mixer by asking for all available samples but it made no difference, sadly.

I used Mario Kart's Wii menu to generate my signal for comparison, and the runs were done with PR# 5631 (https://github.com/dolphin-emu/dolphin/pull/5631)
Sorry for the long lack of reply from my side.
By now, several things have changed: In Faster Melee, a version of the Ishiiruka Dolphin fork configured for Melee, WASAPI support was added by hannesmann. While Cubeb is faster than DirectSound (by about 10 ms), it's still slower than PulseAudio and WASAPI (by about 30 ms).
I've put my oscilloscope measurements into a sheet here: https://docs.google.com/spreadsheets/d/1...d=48074256

The Asus Xonar DG turned out to be one of the most laggy cards I tested. The pro-grade RME Hammerfall HDSP 9632 fared much better, having just as low minimum latency as integrated Realtek audio, but with considerably less crackling problems at the lowest latencies. However, the difference is small enough that I don't think buying a pro-grade sound card just for that is advisable.

WASAPI in exclusive mode turned out to have an average audio input lag of 40.28 ms, which is just 2.05 ms more than on console. However, it should be noted that this comparison uses a polling fix code that aligns software controller poll and hardware controller poll properly, which decreases input lag significantly. I also tested enabling a polling fix code on console, which decreased average audio input lag to 26.65 ms

PulseAudio on Linux was a little bit slower, with averages ending up at 44 ms or more. Part of the reason for this difference seems to be that PulseAudio automatically steps up latency under pressure, but doesn't step down again when there is less pressure, so depending on the sample size for the respective sample set, the chances of the latency having stepped up at the end for a longer or shorter time was higher or lower.

Because on console, audio input lag of as low as 26.65 ms is possible, it seems to me that there might be some potential in the way Dolphin handles emulating audio for further latency reductions.
For competitive netplay, undercutting input lag both for video and for audio is highly desirable.
That's cool, but we don't really care about Faster Melee.
I understand, however I think that lowering audio input lag significantly (or, rather, at least giving the option to by adding WASAPI exclusive into the audio backend dropdown) would be a useful feature for main branch Dolphin too. Don't you agree?

hannesmann

The implementation is here:
https://github.com/FasterMelee/Ishiiruka...PIStream.h
https://github.com/FasterMelee/Ishiiruka...Stream.cpp
and the commit it was added in is here:
https://github.com/FasterMelee/Ishiiruka...5c89d3d3a1
https://github.com/FasterMelee/Ishiiruka...395d043415
I can't be bothered to clean up and merge the implementation into main branch Dolphin right now, but there's no Melee-specific hacks that would break anything (unlike almost everything else in the FM repo)
When we merged cubeb the goal was to cut down on audio backends because cubeb supposedly covered our use cases across our supported platforms. Not add more.

I don't see the appeal of adding a platform exclusive backend when the only people who would care about latency that low aren't going to use master over a fork anyways.

Perhaps I'm missing something and somebody else has some interesting use cases that a typical dolphin master user would care about.
Pages: 1 2