TerryCavanagh/VVVVVV

Harsh noise when playing on speakers (Linux)

Opened this issue · 7 comments

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.

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.

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)

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.

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

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")

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)

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)