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

Harsh noise when playing on speakers (Linux) #970

Open
Fussmatte opened this issue Apr 19, 2023 · 7 comments
Open

Harsh noise when playing on speakers (Linux) #970

Fussmatte opened this issue Apr 19, 2023 · 7 comments

Comments

@Fussmatte
Copy link
Contributor

Fussmatte commented Apr 19, 2023

This has affected me for a good while now. If I have the game open at all, then harsh noises play out over any audio that's currently playing. These noises don't occur during silence, but if I have the game on mute then if anything else plays audio the noises will happen. This only happens with VVVVVV specifically, and on Linux. These noises do not get picked up by screen recorders, so here's a phone recording I took a while back:

20230226_105219.mp4

An extra note: sometimes, the noises will stop altogether during a playthrough, though not before finishing off with an especially harsh noise (as if it was 'flushing out' the problem causing them).

The issue does not occur at all if I'm using headphones. It only happens if I'm playing audio through my (laptop) speakers.

@flibitijibibo
Copy link
Collaborator

One quick test is to run the game with SDL_AUDIODRIVER=disk, which will generate raw float32 PCM that something like Audacity (or whatever's left of Audacity...) can import as raw data. If that comes out clean, it's likely something related to Pulse, and at that point SDL_AUDIODRIVER=pipewire may produce a different result.

@TerryCavanagh
Copy link
Owner

Wow!

(Does this happen with v2.3, I wonder? I haven't seen any reports of this before, so it makes sense that it's due to a change since the last public release)

@flibitijibibo
Copy link
Collaborator

It's possible that the change from SDL_mixer to FAudio changed the app-side mixing, but since it's device-specific that would have to be within SDL, since this would mean that the final mix is being mangled between FAudio and the final output. SDL2's resampler is "eh", but not that eh, so I'm wondering if Pulse doesn't like that FAudio's update size is smaller than SDL_mixer's (FAudio's is about 1/10th SDL_mixer's, for precision/accuracy reasons) and the laptop isn't happy about it. Usually this gets worked around by increasing the OS' latency a bit, but I wouldn't be surprised if using PipeWire was enough to fix the issue properly.

@Fussmatte
Copy link
Contributor Author

Fussmatte commented Apr 19, 2023

It doesn't happen in 2.3, no. I'll test with the SDL_AUDIODRIVER option.

@Fussmatte
Copy link
Contributor Author

Fussmatte commented Apr 19, 2023

The raw audio that SDL_AUDIODRIVER=disk gives doesn't have the noises in it. Lines up with what happens when I try to record it with OBS or whatever else. When I have the option off the noises still happen though. SDL_AUDIODRIVER=pipewire just complains that it can't open an audio device ("target pipewire not available")

@flibitijibibo
Copy link
Collaborator

The raw audio that SDL_AUDIODRIVER=disk gives doesn't have the noises in it. Lines up with what happens when I try to record it with OBS or whatever else. When I have the option off the noises still happen though. SDL_AUDIODRIVER=pipewire just complains that it can't open an audio device

That pretty much settles it - Pulse is giving us sass! A couple options:

  • Update the system to one that uses PipeWire by default; I endorse Fedora but pretty much everybody has moved to PW; Debian 12 is last on the list and will likely be out this summer.
  • Try PULSE_LATENCY_MSEC=60 (or higher, depends on how flaky the sound driver is)

@Fussmatte
Copy link
Contributor Author

Fussmatte commented Apr 19, 2023

First one is not even an option for me, I'm not uprooting my entire OS setup just for a game. Second one seems to work fine, the noises don't occur anymore until I run it without the option

(note: my current OS is Pop!_OS 22.04. I also seem to be able to lower the latency value to about 30 without issues, but 20 starts making weird noises again)

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

No branches or pull requests

4 participants