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

Remove High Frequency Distortion and Prevent Crackling in All Cases #12777

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

Sam-Belliveau
Copy link
Contributor

@Sam-Belliveau Sam-Belliveau commented May 13, 2024

This PR now includes the changes from #12775 for the graphs

This can help stuff like this from happening in the future :)

Changes:

  • Allow Performance Trackers to Custom Time data (time without sleeps + audio latency)
  • Improve Max Speed counter (result of previous change
  • Add Audio Latency graph to track how many buffers are unplayed by dolphin
  • Replace linear interpolation with Sinc filter (removes high frequency distortion)
  • Greatly improve algorithm for keeping audio in sync with video (more consistent + less distortion)
  • Port previous algorithm to Audio Stretcher so that it is much more consistent
  • Play audio backwards when no samples remain in order to prevent crackling
  • Default Timing Variance is now set to 10ms

For some reason, Dolphin was using Linear interpolation for converting audio from 32000hz to 48000hz, this leads to extreme aliasing. The way you can tell there is aliasing is by looking at the high frequencies. In a good resampler, there should be no frequencies above the nyquist frequency (16000hz). Look at the spectrograms provided below, they show a clear improvement with the new resampler.

Before (noise at the top is high frequency distortion):
image

After:
image

image

@Avasam
Copy link
Contributor

Avasam commented May 14, 2024

Audio is noticeably much worst with this PR. Lots of crackling and seems louder.

https://youtu.be/dvQI-K5yUYU

@Sam-Belliveau
Copy link
Contributor Author

Audio is noticeably much worst with this PR. Lots of crackling and seems louder.

https://youtu.be/dvQI-K5yUYU

This is a bug with the Audio Stretching, turn it off and you'll notice a big improvement. I will attempt to fix later.

@Avasam
Copy link
Contributor

Avasam commented May 18, 2024

Tested this PR again today.
With audio stretching:

  • A few stutters after fast-forward, which is much better than before
  • Audio doesn't pitch-shift, but skips when forwarding. Which is better than master's crackly audio when fast-forwarding.

W/o audio stretching:

  • Seamless audio transition when forwarding. Kinda sounds like a DJ table.
  • Audio pitch-shifts, which can sound very aggressive on 500%+ speed, but may be desirable. No crackly audio like there is on master.

Audio pitch aside, which is probably a subjective preference, this seems an improvement on all sides (I'll personally keep audio stretching on to avoid the pitch shift)

@dreamsyntax
Copy link
Member

dreamsyntax commented May 22, 2024

This is a bug with the Audio Stretching, turn it off and you'll notice a big improvement. I will attempt to fix later.

Is this ready for another test (audio stretcher)?

@Sam-Belliveau
Copy link
Contributor Author

This is a bug with the Audio Stretching, turn it off and you'll notice a big improvement. I will attempt to fix later.

Is this ready for another test (audio stretcher)?

@dreamsyntax Yes I fixed the issue with the audio stretcher. Basically the amount of available samples that were actually available was being reported incorrectly, but that was fixed awhile ago.

@Sam-Belliveau Sam-Belliveau changed the title Replace Linear Interpolation with Windowed Sinc Function Replace Linear Interpolation with Windowed Sinc Function + Update Audio Latency Management May 30, 2024
@Sam-Belliveau Sam-Belliveau changed the title Replace Linear Interpolation with Windowed Sinc Function + Update Audio Latency Management Remove High Frequency Distortion and Prevent Crackling in All Cases Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants