Skip to content

Conversation

HEIHUAa
Copy link

@HEIHUAa HEIHUAa commented Sep 9, 2025

I've found that the current detection mechanism for ResyncVocals seems to have issues—it rarely triggers resynchronization when the audio timing desyncs. That's why I've rewritten a better version that ensures vocals can be effectively resynchronized.

@Raltyro
Copy link
Contributor

Raltyro commented Sep 9, 2025

you sure this doesnt get triggered frequently and only happens in a noticable delay

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 9, 2025

你确定这不会频繁触发,并且只在可察觉的延迟时发生

Yes, I achieved high-precision audio offset detection by smoothing the audio time offset.

Unless any issues are discovered, this should be the final version of the modifications.
@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 10, 2025

Alright, unless any issues are discovered, no further modifications should be needed at this point.

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 11, 2025

Here's a summary:

Based on my testing, I’ve found that with my algorithm, any audio desync exceeding 7.1 ms becomes noticeably perceptible.

The smoothed audio offset measurement I implemented effectively prevents false positives in detection.

However, one limitation remains: I haven’t found a way to fully eliminate the slight desync sometimes introduced by resyncVocals() itself. As a result, the system may need to readjust multiple times in quick succession before stabilizing.

In my tests, realignment typically completes within one second, after which the audio remains perfectly synced with no audible issues until the next desync event occurs.

I’ve also done my best to optimize the overall behavior.

Alright, to prevent cases where a sudden large audio offset could cause the smoothed value to instantly exceed the threshold and trigger readjustment, I've made further modifications. I also took the opportunity to tweak a few other things.
@NexIsDumb
Copy link
Member

alright, asked a friend that always had vocal resync problems to test this
lets see how is it

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 21, 2025

好的,询问了一个总是有音轨重同步问题的朋友来测试这个看看效果如何
all right

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 21, 2025

By the way, I actually have a demo video for this on Discord. Although it was recorded during the initial version, it's still quite similar to how it works now.
discord cne

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 23, 2025

I've been working on a new approach for the audio sync issue. The idea is to use imperceptibly small adjustments to the audio playback speed. This keeps the audio drift within a ±1ms range during stable periods, while avoiding the sync disruptions caused by hard resets of the audio position. What are your thoughts? @NexIsDumb

Regarding my previous implementation, I've observed that even within the ±7ms threshold, there can still be subtle, barely perceptible audio drift.

@NexIsDumb
Copy link
Member

mhh then sure, why not trying, lets see if its actually possible and better

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 25, 2025

@NexIsDumb Excuse me for the interruption. I've shared the script that synchronizes audio by adjusting playback speed on Discord. Could you ask your friends to test it? If it works, I'll integrate it into the source code.
discord cne

@NexIsDumb
Copy link
Member

NexIsDumb commented Sep 25, 2025

i havent been answering here cuz that friend of mine hasnt still unfortunately answered :(

i'll prob check it myself then

@NexIsDumb
Copy link
Member

NexIsDumb commented Sep 27, 2025

alrighty, my friend checked and they say its really good, they pulled on sept 12

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

i havent been answering here cuz that friend of mine hasnt still unfortunately answered :(

i'll prob check it myself then

Awesome! I'll migrate it to the source code and push the update later.

@NexIsDumb
Copy link
Member

Awesome! I'll migrate it to the source code and push the update later.

tysm!

@NexIsDumb
Copy link
Member

you know what, at this point, imma make a ping inside the discord for asking everyone to test it so we can be sure 100%
but so far the script works good :D

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

you know what, at this point, imma make a ping inside the discord for asking everyone to test it so we can be sure 100%
but so far the script works good :D

ok

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

I've now integrated the variable-speed audio sync feature into the source code, but I still need to check for any potential issues.

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

Testing complete. I can confirm the HScript calls and core code are functioning properly. Additionally, I can't think of anything else that needs testing at this point.
@NexIsDumb Has anyone who tested this feature reported any issues so far?

@NexIsDumb
Copy link
Member

NexIsDumb commented Sep 27, 2025

Testing complete. I can confirm the HScript calls and core code are functioning properly. Additionally, I can't think of anything else that needs testing at this point.

great!

@NexIsDumb Has anyone who tested this feature reported any issues so far?

not really, lemme ask to some other friends of mine to test this too

Using time-stretching for minor corrections (subtle drift), and hard playback resets for high-latency scenarios. This approach minimizes audible pitch distortion while maintaining high-precision audio playback.
@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

Alright, if no issues arise, this should be the final update.
I've made further revisions to combine the advantages of both time-stretching and direct playback switching:

Time-stretching correction is used for minor adjustments (within ±16ms)

Direct playback reset is applied for higher latency scenarios (beyond ±16ms)
With this configuration, the time-stretching correction becomes nearly imperceptible. At least through headphone monitoring, I couldn't detect any noticeable pitch variation.

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

@NexIsDumb Alright, it's now confirmed that no further modifications will be made unless any issues are reported.🔥🔥🔥

@NexIsDumb
Copy link
Member

@HEIHUAa okay so the only report ive received is that the vocals get fucky if the timeScale isnt 1

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

Alright, I'll try to address this issue.

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

@HEIHUAa okay so the only report ive received is that the vocals get fucky if the timeScale isnt 1

@NexIsDumb Could you tell me what the specific issue is? I tested it and didn't seem to find any problems.😳😳😳

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 27, 2025

Could it be that modifying the timeScale itself causes pitch changes in all audio?

@NexIsDumb
Copy link
Member

lemme ask

@NexIsDumb
Copy link
Member

NexIsDumb commented Sep 28, 2025

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 28, 2025

https://cdn.discordapp.com/attachments/1345595205121871874/1421702329773592636/2025-09-28_13-34-25.mp4?ex=68d9fef9&is=68d8ad79&hm=e42c52254c7588e290ea7c3a71bc8e35e24c08800f3f13636faff50af6185e3e&

the vocals just loop instead of the song finishing and different timescale values jump back and forth to different points in the song

for reference the song is supposed to end here

https://media.discordapp.net/attachments/1385958897474343057/1421703178826678414/2025-09-28_13-39-46.mp4?ex=68d9ffc3&is=68d8ae43&hm=dc6e7ea3c2965c16716f4d61eec04a6244aa1120254c8143e681bf4c57fbeb68&

Alright, I'll definitely check it out in a few hours.

@HEIHUAa
Copy link
Author

HEIHUAa commented Sep 28, 2025

@NexIsDumb Alright, I've attempted to fix this issue. On my end, I can't seem to reproduce the problem, but I've kept the trace statements in place. If the issue persists, please try to include the output results when recording a video.

@NexIsDumb
Copy link
Member

lemme ask again, tysm

@Raltyro
Copy link
Contributor

Raltyro commented Oct 4, 2025

I wanna merge this, is it good now to merge?

@Raltyro
Copy link
Contributor

Raltyro commented Oct 4, 2025

Woah what the fuck

@NexIsDumb
Copy link
Member

still not, i have a friend testing it still cuz it has some issues
also lil update: shes gonna try again today with the latest commit

@HEIHUAa
Copy link
Author

HEIHUAa commented Oct 8, 2025

🔥🔥🔥

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

Successfully merging this pull request may close these issues.

3 participants