mdias / rs_asio

ASIO for Rocksmith 2014
MIT License
1.06k stars 102 forks source link

Hello friend! I got some tests! #172

Open SAARussian opened 3 years ago

SAARussian commented 3 years ago

So, as you know I like to test latency stuff, so here it is:

1) Im measured DAW Roundtrip from MAIN OUT to MIC 1 = its about 5 ms on 16 samples / 48000 Hz Image 128

2) Im measured latency from MAIN OUT to LOOP-BACK IN = 4 ms Image 127

3) Than I compared latency of MIC 1 vs LOOP-BACK IN = 17 ms (so LatencyBuffer in rocksmith.ini has an effect on the latency, and MaxOutputBufferSize doesn't (maybe its just picked from asio buffer size). Image 126

4) 17 ms (of compare) - 4 ms (of looping) + 5 ms (of roundtrip) = 18 ms rocksmith roundtrip latency.

So, I have a question, where rocksmith gets this additional 13 ms (5 ms daw RT vs 18 RS RT)?

mdias commented 3 years ago

Hello,

I don't know how Rocksmith's internal audio pipeline works so I cannot tell you anything for sure, LatencyBuffer is likely the amount of buffers queued for processing, therefore it should increase the latency by LatencyBuffer * BufferSize. MaxOutputBufferSize indeed won't affect you when using RS ASIO, unless maybe when BufferSizeMode=host but even then it depends.

As for the extra latency, I can tell you that your ASIO driver is constantly calling on RS ASIO with an interval that depends on the chosen buffer size, and when this call happens RS ASIO has the chance of: 1) Save the incoming input data so that when Rocksmith asks for it, we give access to it 2) Outputting to the output buffers the audio that rocksmith has given to RS ASIO, and tell Rocksmith that we're ready to accept more data to output.

Without access to Rocksmith's source code we cannot know what happens between step 1 and step 2. We don't know how many buffer flips happen between when the game reads the input buffer and it's processed result comes through the output. Some testing would have to be performed to discover how long exactly is this delay, and how much does it depend on the buffer sizes.

It's a very interesting question though.

mdias commented 3 years ago

I did some tests and on my machine it's even worse. It seems I have "base latency" of ~16ms in Rocksmith itself, and it can vary a bit as I restart the game. So this is probably related to how good your system in general is at low latency processing. I also just remembered that Rocksmith is not built with the knowledge that the output and input device are one and the same and have their clock in sync. Whatever it does to compensate for the clock drift with the normal scenario probably adds a considerable amount of latency.

SAARussian commented 3 years ago

What do you think, if I would play with a real tone cable, through a standard rocksmith driver (wasapi exclusive?), on a modern motherboard with a top chipset, with some kind of intel core 10th generation, in an exclusive mode with buffer latency = 1. The delay in theory should be less than at the moment I have (18 ms)?

mdias commented 3 years ago

I have no idea, it may be better or worse. Having a fast CPU is not enough of a guarantee that your latency will be better. There are many things at play when considering latency, and even the operating system and its drivers will have a major impact on it.

Also notice that we're doing blind testing; we don't actually know how Rocksmith does its thing internally so we don't know all the factors involved just in the game itself. However I would guess that on that system you describe you'd still achieve lower latency using ASIO with a buffer lower than 144 assuming you have a good interface and drivers.