UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
843 stars 161 forks source link

Editor - GAP delayed #673

Open DoubleDee73 opened 1 year ago

DoubleDee73 commented 1 year ago

Actual behaviour

The GAP appears to be delayed by about 60 ms. When creating songs, the "Audio/Video delay" must have been set to -60 ms (minus!) so that the GAP is correct. When singing, the "Audio/Video delay" can then be set back to 0.

Expected behaviour

The GAP should be, where the actual audio is in the editor (not in game mode, that seems to be fine)

Steps to reproduce

  1. Pick any song, open it up in any audio editor (e. g. Audacity) and check where the the gap should be
  2. Open the song in the USDX song editor and set the gap accordingly
  3. Move the first note so that the last part overlaps with 1 (e. g. if a note has a length of 4, set the start point of this note to -3, so the last fourth of the note is on 1
  4. Hit the space part and listen to the audio of that first note

The audio will play without any singing voice audible. If the gap was set correctly, the first syllable of singing should be played. If played in YASS, the clicks appear to be correct.

Details

Provide some additional information:

Example:

Here's an example of "Genesis - Illegal Alien", which I have created with a #GAP of 20520 - which is the left side of the marked area in white. The right side of the marked area is where the #GAP probably should have been - around 20580 audition_genesis_illegal_alien The higher green peaks to the right of the marked area is, where Phil starts singing. With that setting, the clicks in Yass sound exactly on time. In the USDX Editor, setting it to 20580 appears to be 60 ms too late (thus I originally set it too 20520).

barbeque-squared commented 1 year ago

There is as far as I've been able to find only one place in the entire codebase that actually does anything with the AVDelay: TAudioPlaybackBase.GetPosition Which doesn't exactly help me narrow things down because it's the magic getter for the Position field. My editor isn't good enough to find the actual usages, and searching for Position matches way too much to be useful.

I did find this feature request: #226 and there appears to have been made a commit related to it: a208f93c8a5454e4bf36fdcb085bf3cea485023b

But this still doesn't make any sense because as long as you have the AVDelay set to 0, it shouldn't ever do anything, so using -60 feels more like a workaround for some other problem.

Could you go back to a really old version (2017.8.0 should be enough) and verify that the delay issue is also present there? Because if yes, that would at least rule out this being caused by the AVDelay setting.


If the issue is also present in 2017.8.0, could you go back to a modern version and run these experiments for me? Use AVDelay = 0 in all cases please. For all except the first two, please both in the editor (play a few notes) and sing a few lines and describe if the gap feels different (not necessarily correct) now:

I have no idea on what could be the actual cause, my hope is that either one of these will make the issue suddenly a lot worse, or appear to fix it, because that would at least give some direction into finding the root cause.

DoubleDee73 commented 1 year ago

So 2017.8 has the same issue. In 2023.5 I tried what you said:

barbeque-squared commented 1 year ago

So 2017.8 has the same issue.

Well, at least that rules out the AVDelay as being the cause of this issue. It's something that has been in here for a long time.

It's a shame the other experiments do nothing either, this doesn't exactly narrow things down. I did notice that the editor seeking/playback is a bit weird the other day, as in when playing a short note over and over it doesn't always play the same audio part. Both where it starts and end can vary (enough to be noticeable). I'll look into that some day.