forum

[added] [Gameplay] ASIO / WASAPI (exclusive) support

posted
Total Posts
62
This is a feature request. Feature requests can be voted up by supporters.
Current Priority: +5,996
Topic Starter
rustbell
READ BEFORE PROMOTE
Edit: Changed title to fit the topic. the post is talking about ASIO, but WASAPI exclusive mode also works.

Audio Stream Input/Output (ASIO) is a computer sound card driver protocol for digital audio specified by Steinberg, providing a low-latency and high fidelity interface between a software application and a computer's sound card. Whereas Microsoft's DirectSound is commonly used as an intermediary signal path for non-professional users, ASIO allows musicians and sound engineers to access external hardware directly.
(https://en.wikipedia.org/wiki/Audio_Stream_Input/Output)


To be short, ASIO is a sound protocol that recudes sound output latency. Among all music games I prefer LR2 the best, mostly because LR2 has official ASIO output support. Compared with legacy protocols ASIO could provide a lot better playing experience on music games, not only on recording. Besides sound output latency, ASIO bypasses sound mixing in Windows OS, making the sound more natural (I've found that osu sounds a little bit strange after Windows Vista).

One of my friends (around overall rank #150) happens to be very rich and have MANY professional sound card that support universal ASIO output but still meets the latency. Onboard sound cards don't have official support, but we can use ASIO4ALL to simulate it, and it makes sense.

Recently my friend and I did some recording to find out how long the latency is.
the first one comes from my friend and latter 2 are captured on my own, with 1000hz poll rate mechanical keyboard.

I'm disclaiming that the keyboard input detection is not the main issue. The problem is, how players judge if they successfully hit the circle is by hearing the hitsound (the graphic appears relatively slow), especially among top players, however the hitsounds are not ringing at the exact time. They may feel confused when playing very fast maps.

This is more of my personal request since my playing skill is more based on LR2. However the fact is that not only me could not put up with that "small" latency. Btw, 70ms can make a huge difference at top-tier playing.

I've also tried WASAPI on LR2 but it turned out to be even worse. Not sure if it is LR2's problem.
Kradfiz
Does this mean that the players are normally hitting the notes 70ms off of where they actually should be?
MillhioreF
70ms is the worst case scenario. Usually it's less than 10ms, but this depends on your drivers, where ASIO skips the drivers entirely if I'm understanding right.

Could be interesting, if it's not hard to code in I don't see why not.
ArcherLove
I wish I have vote haha, this will fix offset issue @ osu!mania!
Fubukicat
''waiting 24 hours ''
Topic Starter
rustbell

Kradfiz wrote:

Does this mean that the players are normally hitting the notes 70ms off of where they actually should be?
"In the worst case", yes. But the program judges when you hit the keyboard, not when the hitsound yells.
This causes a confusing situation since the cursor on the screen doesn't affected by the sound.
Davin Fortune

ArcherLove wrote:

I wish I have vote haha, this will fix offset issue @ osu!mania!
Endaris
This would be great.
Too bad I had only 1 star left to throw.
iMey
Sorry for my poor English.

 In the past few months,I had testing every sound cards I can find ( including USB2.0,USB3.0,PCI), ( including 1394, fiber,PDIF,3.5mm),(including Independent,integrated and virtual sound card).
 The test method is prepare a map with mute bgm , which only with hit sounds when i play it. in this way I could using a phone to recording the sounds of my keyboard and the hitsounds at the same time.The recording can be identified by spectrum analysis software. (my keyboard is CoolMaster Quick Fire with 1000hz)
  It was found that the latency which was between the 50ms~70ms in all sound cards.some of sound cards delay in the 50ms and some are 60ms, even 70ms.
 As a contrast,i test it in LR2,however, no matter native ASIO or virtual ASIO (asio4all), i realy can't identified a clear latency until I choose the Direct Sound. it will be consistent with the same latency in LR2 and osu! if without ASIO.
  
 The key point is not the keyboard input or the Display delay, but between the <hit sound> and <my chick> have a very serious sense of separation which was confused my sense of confirmation.That is the reason why I do that test.
  I am writing in the hope of the osu! dev team's assistance to fix that offset issues.it is very very very very useful for me witch could make a quite diffdrent.THANKS!
fb39ca4
Why use ASIO when you can use WASAPI exclusive mode instead?

ASIO is a third party API from ~15 years ago when Windows had poor sound support. It's quite clunky to use and requires a supported sound card or the ASIO4ALL driver.

WASAPI is a more modern API that was introduced with Windows Vista to fix the problems with sound in previous versions of Windows, and offers an exclusive mode that will bypass OS-level mixing and reduce latency, same as ASIO.
Topic Starter
rustbell

fb39ca4 wrote:

Why use ASIO when you can use WASAPI exclusive mode instead?

ASIO is a third party API from ~15 years ago when Windows had poor sound support. It's quite clunky to use and requires a supported sound card or the ASIO4ALL driver.

WASAPI is a more modern API that was introduced with Windows Vista to fix the problems with sound in previous versions of Windows, and offers an exclusive mode that will bypass OS-level mixing and reduce latency, same as ASIO.
WASAPI exclusive mode is also good but I didn't have a chance to use it. LR2 doesn't use exclusive mode.
Also ASIO is better on cross platform programming xd
-Sandy Corzeta-
I really like this feature and kinda support this.
But sadly and unfortunately, peppy won't make this happen since these kind of realtime audio processing things like ASIO is Windows Exclusive which is not a part of his project to make the game widely open on cross platform (Linux and OSX).

If they do really care about this feature, there would be a huge pain ass of writing code to support this kind of realtime audio processing for each of their own platform like Core Audio for OSX and JACK interface for Linux.

Doesn't want to disappoint it, but i don't really sure this could be happen in the future.

EDIT : Take a notice for the latest major changes on osu! itself. They're now majorly using OpenGL instead of DirectX. So it is like confirmed they working on how to make this game cross-platform, and not windows-exclusive anymore.
peppy
As mentioned in the OP, the usual case is well under 10ms latency using DirectSound (I've tested on multiple onboard and external sound cards). Adding ASIO support brings with it compatibility issues, futher dependencies, and usually not enough gain to be worth it.

I've experimented with ASIO previously (a few years ago) and it wasn't worth the effort. These days that applies even more so, as sounds cards (and their support for DirectSound) and windows mixing latency are in a far better state than when ASIO was actually useful.

There's better gains to be made elsewhere, such as decoupling the input handling from draw process (something we are working on this year).

WSAPI on the other hand is something that is possible (it's basically a single flag change in the library we use) but requires updating the library to the latest version. This is something on my short-term priority list for other reasons, so you may see that happen in the very near future.
Topic Starter
rustbell

peppy wrote:

WSAPI on the other hand is something that is possible (it's basically a single flag change in the library we use) but requires updating the library to the latest version. This is something on my short-term priority list for other reasons, so you may see that happen in the very near future.
Glad to hear that. One more question here, is it involving exclusive mode? This can be ideal. Or just add an option to enable exclusive mode.
BilliumMoto
I get 80ms latency on average, thank the lord
peppy
How are you even calculating 80ms
Topic Starter
rustbell
Let me explain more here. The latency is made up of several parts:

1. Keyboard. As I know all keyboard would delay every single input to prevent double clicking. This latency is relative low.
2. USB polling rate. 125hz keyboards would give 8ms more while 1000hz keyboards give only 1ms. (PS/2 keyboards use interruption, giving nearly no latency)
3. Directsound buffer (or system sound mixer). This is the main part, since it takes about 50ms of total and could be cut off.
4. System side etc, generally this would not be the problem.

This request only involves the third part.

edited
peppy
I was talking to BilliumMoto, who quoted 80ms.

There's no way directsound adds 50ms. your sound card's drivers are FUCKED if that is the case.

Also your numbers are off. No (good) keyboard is as high as 40ms and most are FAR under 10ms. Get a high speed camera and actually measure your shit before barfing numbers.
Topic Starter
rustbell
I was told that keyboard delays about 20ms, whatever
If not directsound then it is the system mixer that gives 50ms, which is ASIO and WASAPI exclusive mode trying to bypass

I used "OR" because i cant exactly point out where the problem is.

EDIT: Microsoft has a document about Windows 10 Low Latency Audio. For not adjusted cases the buffer size is set to ~10ms, causing relatively high Roundtrip latency. A graph is under Measurement_Tools tag. (aiming at new api though)
peppy
I just did a full input-output path test on my system with osu! running at 240fps, which is nowhere near optimal. From mouse click to headphone output was averaging 36ms. That includes:

- mouse latency (logitech g500 wired running at 500hz ~2ms)
- osu! frame latency (up to 5ms)
- windows directsound routing (windows 10)
- my usb DAC headphone amplifier (i know this adds around 5-10ms)

i'd bet that the audio part of this is likely 20ms or less. i'd also bet an onboard sound card would do better than this in most cases.

test performed using iphone at 240fps, comparing milliseconds between physical click sound of mouse and headphone output of metronomehigh.wav (the thing that plays in the editor on upbeats of the metronome; used since it's high pitch and each to see in the waveform). note that 240fps is not a limiting factor as audio is not "framed" at that rate, but is 44.1khz, giving near perfect resolution.
iiyo

peppy wrote:

I just did a full input-output path test on my system with osu! running at 240fps, which is nowhere near optimal. From mouse click to headphone output was averaging 36ms. That includes:

- mouse latency (logitech g500 wired running at 500hz ~2ms)
- osu! frame latency (up to 5ms)
- windows directsound routing (windows 10)
- my usb DAC headphone amplifier (i know this adds around 5-10ms)

i'd bet that the audio part of this is likely 20ms or less. i'd also bet an onboard sound card would do better than this in most cases.
Does windows 7 differ from windows 10 and 8? in terms of audio ms and latency ?
peppy
windows 10 > windows 8 > windows 7

win7 is when they introduced the new architecture, which was young (as were the drivers to support it).
Kaofie

peppy wrote:

windows 10 > windows 8 > windows 7

win7 is when they introduced the new architecture, which was young (as were the drivers to support it).
Time to upgrade to windows 10 then d:
Vantavia
Keyboard latency IS generally around 10-40ms because of debounce code being poorly implemented/overcompensated. Not that it can't be close to 1ms, but only the romer g logitech switches and a4tech's optical switches achieve that currently.

The same state exists with mouse button latency, with logitech being a few ms and most other brands being around 8ms upto almost 40ms in a worst case scenario.

http://cdn.overclock.net/8/8e/8e56a60d_ ... 150718.png
peppy
I guess I chose well with my keyboard and mouse, as mine are within a few milliseconds in both cases!
show more
Please sign in to reply.

New reply