forum

[Gameplay] ASIO / WASAPI (exclusive) support

posted
Total Posts
64
This is a feature request. Feature requests can be voted up by supporters.
Current Priority: +6,066
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!
arviejhay
i like how this 48 hours post have 2k stars
Vanilla

arviejhay wrote:

i like how this 48 hours post have 2k stars
hi reddit and pro player feature request
Topic Starter
rustbell

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.

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.
o_o
I am surprised that you can get such low latency. I've tried different PCs but none of them performs very well.

Proving this be a common issue requires a lot of valid testing samples, which takes a lot of effort, making it not worthy.
Since ppy already has a plan to add WASAPI output support, I better hang this up and wait. :?
Spy
I thought it is deltaMAX thread
BilliumMoto

peppy wrote:

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.

I recorded myself, delay is indeed about 100ms, worse than I originally thought
Mp3 of recording here: http://puu.sh/nyBAk/3c83268efd.mp3
Both keyboard and laptop speakers were placed within a foot of the mic.

I have Win10, Pok3r keyboard with standard drivers, using DirectSound with a pretty generic audio card that comes with any decent Lenovo Laptop.
If you can fix my problem please do, because according to you something is seriously fucked with my computer.

Also have more tact before calling someone a "number barfer" next time, PR is important sometimes. Thanks.

Edit: Might be worth noting that this was tested in a Mania map, since for some reason Mania has an additional latency built in, at least that's how it seems.
TakuMii
^...I consider myself a latency snob, and even I find that hard to believe... Even the worst mechanical keyboards (aka Razer) have measured delays of around 30ms. Unless you're doing something ridiculous like running the game with Vsync turned on (or even playing in windowed mode), there has to be something incredibly wrong with your setup or method of measurement.
BilliumMoto
I can assure you that Vsync is not on, and that the recording was made while playing in fullscreen.
Also that this has been the latency I've experienced since day one of installing osu (on a different computer from the one I currently use).
If I'm really the only dude out of thousands who experience latency problems this bad, so be it.
peppy
I can assure you that what you are seeing is very likely not a directsound-related issue. I'm pretty sure switching out directsound alone will not fix your problem, unfortunately.
DimenSham
Try to find out if the USB port you are using is going through an extra hub. If I use my keyboard through the ASMedia ASM1042 hub that controls half of my USB ports on the motherboard it adds roughly 55ms but I can avoid this by going straight to the chipset. Only one out of the 8 keyboards I tried was noticeably different than the others, even my cheap scissor switch model matched the input latency of my mechanical keyboards.
peppy
USB hubs can be quite bad, yes.
iMey
A very exciting result.

According to Microsoft's documentation, I upgrade my computer's operating system from win7 to win10, and change to the driver by Microsoft win10 from the third-party driver.
In win7 or win10 with third-party driver, Repeated testing shows my computer has 55-65ms delay to get the hitsounds with keyboard, but in win10 with MS's driver. My 1000Hz keyboard testing's result is about 40ms, relatively stable, 125Hz mouse results between 45ms to 60ms, not very stable.

The delay has been greatly reduced obviously.

Keyboard Testing Picture
Keyboard Sounds Recording Files
Mouse Testing Picture
Mouse Sounds Recording Files

Sounds Card: ALC888(onboard)
Keyboard:CM Quick Fire(1000hz)
Mouse:Lenovo N14608(125hz)
Drivers:10.0.10240.16384
vincaslt
I experience insane audio delays when DOLBY digital plus is turned on. Turning it off lowers the latency significantly, so watch out for that.
peppy
Yes, you don't want DOLBY on. Also turn off all windows-level "enhancements":

Danshi_old_1

peppy wrote:

Yes, you don't want DOLBY on. Also turn off all windows-level "enhancements":

Well this fixed my quiet audio.. Got a fright when I clicked apply.
Evil Peppy
peppy
It's for the best. If you have loudness equaliser on, your audio volume will be very dynamic in places it shouldn't be.
Tanomoshii Nekojou
Oooooooooohhhh! Finally I found this! :D I think this will correct osu!'s accuracy in audio output~. :)
mxp
I've been thinking about this for the past year. Finally it's actually coming to the attention of everyone else. I seriously hope this becomes a thing.
vincaslt

peppy wrote:

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.
May I ask how you measure 10ms delay, because if I had it, I would be pretty happy. I measure 51-56ms delay on my computer from mouse click to actual hitsound with the best settings I managed to find.
peppy
I can assure you that what you are seeing is very likely not a directsound-related issue. I'm pretty sure switching out directsound alone will not fix your problem, unfortunately.
Zinkon

peppy wrote:

I can assure you that what you are seeing is very likely not a directsound-related issue. I'm pretty sure switching out directsound alone will not fix your problem, unfortunately.
I tested on a random piano program the delays of WASAPI, ASIO and Direct Sound. Had microphone near mouse and speakers, clicked a few times, found the average delay between the two. WASAPI - ~55 ms. ASIO @ 128 buffer size ~20 ms. ASIO @ 512 buffer size ~35ms. Direct Sound ~ 70 ms. So ASIO definitely 100% fixes the problem. I tested directly in osu! as well and got ~57 ms. I tested the delay on 7 friend's PC's as well and it was never below 50 ms. It was usually 50-100 ms.

Since I cannot believe you achieve <10ms I request proof. A recording of you mouse clicking and the resulting hit sounds coming out of the speakers. Preferably the hit sound would be a clicky one.

I would kill for audio delay reduction. The fun it provides is immeasurable.

Edit: I read the entire thread, I'll try to upgrade to Windows 10 and see if I get a difference

Edit2: With Windows 10 I'm getting ~51 ms mouse click to ingame hit sound delay. Which is about 6 ms better than Windows 8.1. Well that's nice. I still want to try out WASAPI though. And of course ASIO would be the ultimate heaven

Edit3: Recalculated the piano results with Windows 10:

Direct Sound ~60 ms
WASAPI ~50 ms
WASAPI in exclusive mode ~17 ms
Chirimu

Zinkon wrote:

peppy wrote:

I can assure you that what you are seeing is very likely not a directsound-related issue. I'm pretty sure switching out directsound alone will not fix your problem, unfortunately.
I tested on a random piano program the delays of WASAPI, ASIO and Direct Sound. Had microphone near mouse and speakers, clicked a few times, found the average delay between the two. WASAPI - ~55 ms. ASIO @ 128 buffer size ~20 ms. ASIO @ 512 buffer size ~35ms. Direct Sound ~ 70 ms. So ASIO definitely 100% fixes the problem. I tested directly in osu! as well and got ~57 ms. I tested the delay on 7 friend's PC's as well and it was never below 50 ms. It was usually 50-100 ms.

Since I cannot believe you achieve <10ms I request proof. A recording of you mouse clicking and the resulting hit sounds coming out of the speakers. Preferably the hit sound would be a clicky one.

I would kill for audio delay reduction. The fun it provides is immeasurable.

Edit: I read the entire thread, I'll try to upgrade to Windows 10 and see if I get a difference

Edit2: With Windows 10 I'm getting ~51 ms mouse click to ingame hit sound delay. Which is about 6 ms better than Windows 8.1. Well that's nice. I still want to try out WASAPI though. And of course ASIO would be the ultimate heaven

If you can upload a proof that ASIO is working better with this random piano program, this could be a nice argument for this feature request. (Or i test it myself and upload the result)
mideeli

[ Rin Satsuki ] wrote:

Zinkon wrote:

I tested on a random piano program the delays of WASAPI, ASIO and Direct Sound. Had microphone near mouse and speakers, clicked a few times, found the average delay between the two. WASAPI - ~55 ms. ASIO @ 128 buffer size ~20 ms. ASIO @ 512 buffer size ~35ms. Direct Sound ~ 70 ms. So ASIO definitely 100% fixes the problem. I tested directly in osu! as well and got ~57 ms. I tested the delay on 7 friend's PC's as well and it was never below 50 ms. It was usually 50-100 ms.

Since I cannot believe you achieve <10ms I request proof. A recording of you mouse clicking and the resulting hit sounds coming out of the speakers. Preferably the hit sound would be a clicky one.

I would kill for audio delay reduction. The fun it provides is immeasurable.

Edit: I read the entire thread, I'll try to upgrade to Windows 10 and see if I get a difference

Edit2: With Windows 10 I'm getting ~51 ms mouse click to ingame hit sound delay. Which is about 6 ms better than Windows 8.1. Well that's nice. I still want to try out WASAPI though. And of course ASIO would be the ultimate heaven

If you can upload a proof that ASIO is working better with this random piano program, this could be a nice argument for this feature request. (Or i test it myself and upload the result)
Here is the guide Zinkon used. You can use it and verify the results yourself and get pseudo ASIO hitsounds for Osu.
Zinkon
Recalculated the piano results with Windows 10:

Direct Sound ~60 ms Proof: Image Sound file
WASAPI ~50 ms Proof: Image Sound file
WASAPI in exclusive mode ~17 ms Proof: Image Sound file
osu! ingame ~51 ms Proof: Image Sound file

Basically my dream right now is a WASAPI audio option with an "Exclusive mode" checkbox. Didn't even test ASIO because WASAPI is plenty good enough and peppy already said it was easy enough to implement. So now I'm shaking with excitement :D
GatorZZ

Zinkon wrote:

WASAPI in exclusive mode ~17 ms Proof: Image Sound file
]
Hnnnng. Yes please!
-Tooru-
Yes please. I've never been able to properly use hitsounds because of my UO offset, so if this can somehow help, it'd be truly amazing..
show more
Please sign in to reply.

New reply