Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latency problem #253

Open
zotyo86 opened this issue Jan 13, 2022 · 2 comments
Open

Latency problem #253

zotyo86 opened this issue Jan 13, 2022 · 2 comments

Comments

@zotyo86
Copy link

zotyo86 commented Jan 13, 2022

I found a fairly accurate way to measure the overall latency of the signal processing of Rocksmith (or any guitar effect processor software). I found that I get roughly double latency with Rocksmith than using NI Guitar Rig 4 for processing the analogue signal of my guitar/bass, while my ASIO driver settings, audio interface and overall configuration is the same.

The results:
latency with RS: 35 ms
latency with GR4: 18 ms

Details:
For both measurements I used the same setup:

  • Line6 HX Stomp as input/output interface
  • Latest ASIO driver is installed
  • ASIO interface is used (thanks to RS_ASIO for Rocksmith)
  • Buffer size set up as 128 in the ASIO driver of the Stomp HX, also forced within RS_ASIO config.
  • See RS .ini files at the bottom of the page
  • LatencyBuffer=2 for RS specifically, there is no similar parameter in GR4.

How do I measure latency?
I first make a preset on my HX Stomp that includes just a sole Amp+Cabinet model, with a clean sound. I route the output of this preset to the Send jack of the Stomp. This will be used as reference signal, since the Stomp has negligible latency (I assume 2..3 ms max.)
The Stomp is also connected to my computer via USB as audio interface. The processed signal from RS or GR4 is routed to its main output jacks (left and right) as the signal to be evaluated against the reference signal.
To be able to analyse the delay between the signal of the two paths offline, one just has to make a recording of both signals simultanously with a simple digital stereo recorder. In my case the recorder is my stereo looper (Boss RC3). I connect the Send output from the Stomp into input A on the looper and connect the main output left channel into input B on the looper. This way the reference output from the Stomp is recorded in the left channel, and the RS (or GR4) output is recorded in the right channel of the same recording.
My instrument (guitar or bass) is plugged into the instrument input of the Stomp, and RS is getting the input signal from Stomp via USB channel 5 (dry input w/o processing). I set up a very pure amp+cab rig in RS.
For the actual measurement I launch Rocksmith, start recording on my looper and pluck some firm, discrete and short notes on my bass, preferably on the G string. Then I save the recording on the looper as .wav. Once I import the file into a wave editor, I can measure the delay between the left and right signals based on the timestamps of where the notes are started (one has to zoom in really). I usually take the delay between at least 5..6 samples (sample means the same note in the left and the right channels) and take an average for the latency. I found the deviation is quite low among the samples (0 or 1 ms).
I think this method gives a realistic picture about the real latency at the output, especally for comparison between RS and GR4, since both sources are evaluated against the same reference source. (GR4 states in the audio settings that the calculated latency with the set buffer size is 21 ms which is really close to my measured 18 ms considering the extra 2..3 ms of the Stomp that is excluded from my measurement due to the method, but shoud be added to get the total latency.)

Conclusion
I get significantly higher latency with Rocksmith, although my hardware looks capable for lower, proven with Guitar Rig, as I get perfect quality sound from it without cracking etc, with less latency.

In general I use the Stomp for processing my guitar/bass, and I mute the guitar/bass signal coming from RS. This way I hear my instrument without latency. I (as guitarists in general) play aligned with the song I hear, not with the notes visibly coming on the note highway. If I hear the song with a delay, I will play the notes with the same delay and consequently RS will detect my notes as late (or at least I get only 'Good' instead of 'Perfect' in score attack mode). Therefore I want to reduce this latency as much as possible.

I tried

  • reducing the LatencyBuffer to 1 but I get only distorted noise from the game, no matter what buffer size I set up (tried up to 2048).
  • setting buffer size lower but very annoying cracking noises start appearing.
  • setting the output interface to WASABI in the RS_ASIO configuration, surprisingly the latency did not change significantly (measured 33 ms).
  • playing the notes slightly earlier than the beat, I can get 'perfects' all the time. But it sounds terrible, and will not give me benefit as a hobby musician. I can get more scores though..
  • adjusting display lag. Ended up at 0, as making it higher only makes my notes being detected by RS even later (less scores).

Questions:
What could be the reason for RS with your ASIO layer ending up at significantly higher latency than another program utilising the same hardware, driver and configuration?
What else can I try to improve the latency in RS using RS_ASIO?

Rocksmith.ini

[Audio]
EnableMicrophone=0
ExclusiveMode=1
LatencyBuffer=2
ForceDefaultPlaybackDevice=0
ForceWDM=0
ForceDirectXSink=0
DumpAudioLog=0
MaxOutputBufferSize=0
RealToneCableOnly=0
Win32UltraLowLatencyMode=1

RS_ASIO.ini

[Asio]
; available buffer size modes:
;    driver - respect buffer size setting set in the driver
;    host   - use a buffer size as close as possible as that requested by the host application
;    custom - use the buffer size specified in CustomBufferSize field
BufferSizeMode=custom
CustomBufferSize=128

[Asio.Output]
Driver=ASIO HX Stomp
BaseChannel=0
	; 0 - output on Phones/Main only
	; 1 - output on Phones/Main & Send
	; 2 - output on Send only
AltBaseChannel=
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=40

[Asio.Input.0]
Driver=ASIO HX Stomp
Channel=4
	; 0 means feeding RS with wet signal from HX Stomp Path A for note detection (USB1)
	; 4 means feeding RS with dry DI signal from HX Stomp for note detection (USB5)
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=700
	; HX Stomp sends USB signal with unity gain, which is too low for RS to calibrate properly.
	; 700% gain is defined to compensate for this.

[Asio.Input.1]
;shall be kept empty, otherwise RS will detect two conflicting cables.
Driver=
Channel=1
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=100

[Asio.Input.Mic]
; microphone is not used.
Driver=
Channel=
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=100
@theSG
Copy link

theSG commented Jan 13, 2022

I guess it's just the way rocksmith handles the audio.
I also measured my latency some time ago and with realtone cable through wasapi (no rs_asio) the best result I got was 29ms, while I could easily get 14 ms (again with realtone cable through wasapi) in any other program.
so while you can get some latency improvements (I'm getting lower results with rs_asio by my measurements) overall rocksmith latency will never be as low as in other apps.

@mdias
Copy link
Owner

mdias commented Jan 14, 2022

You might be interested in checking issue #172

FYI I made the tests by dumping both the input and output buffer data flowing through ASIO callbacks from the driver and checking how many samples there are between the moment we feed Rocksmith some guitar sound and the moment it's amp starts outputting audio in the main menu.

This should allow to measure the latency from Rocksmith processing alone and altough it fluctuated a bit, it was around ~16ms which actually seems to pretty much align perfectly with your tests (your "hw" latency being 18ms, plus the 16ms from Rocksmith from my tests being 34ms).

As for the reason for this extra latency it's something I can't accurately tell since I don't have access to Rocksmith's source code. But I would guess this is related to several things, like:

  • Rocksmith being prepared to handle several interfaces (1 output plus 1 or 2 inputs) instead of just one (like most ASIO-enabled software) which means it has to handle clock drifting while most other ASIO-enabled software does not.
  • It's AMP DSP processing might be tuned to avoid some issues on systems that aren't so good at achieving low latency, therefore it may have a different buffer size than what you use on your interface.
  • This is a wild guess: the ~16ms is curious as it aligns with the 60hz refresh rate of my monitor; maybe the sound processing is somehow also affected by screen refresh rate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants