flyinghead / flycast

Flycast is a multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator
GNU General Public License v2.0
1.46k stars 174 forks source link

Sound crackles / pops with DirectSound audio driver #425

Open prietveld opened 2 years ago

prietveld commented 2 years ago

Platform / OS / Hardware

Windows 7x64 and Windows 10 Intel Core i7-975 Nvidia GTX 1080 Ti Creative Sound Blaster X-Fi Titanium Fatal1ty Professional

Description of the Issue

With both v1.0 and 1.1, when using DirectSound the audio crackles and pops. It is immediately noticeable on the BIOS / boot screen. The amount seems to vary per game, but it is most noticeable during FMV. The sdl2 driver does not have this issue (though default volume is very loud and boomy), but it does have the occasional audio drop-out or hitch during gameplay.

Interestingly, the version of Flycast I had installed before v1.1 (which I unfortunately no longer have access to and cannot confirm the version of- though it wasn't 1.x) did not have this issue. Were there versions available for download prior to 1.0 (or between 1.0 and 1.1) that have been taken offline? It did not yet have mouse capture is all I can confirm about it.

Debugging Steps Tested

Basically tried all settings I could imagine being even remotely related, with zero effect (other than the sdl2 backend, see above).

Logs Gathered

Let me know if further information is required.

flyinghead commented 2 years ago

There was a change not long before 1.0 was released to the DirectSound driver: it now uses a dedicated thread and honors the Audio Latency setting. I suppose you were using a debug version that predates this change (builds are kept for 3 months).

That doesn't explain your issues though. I just tested on a low end win10 PC (i5-7260U @ 2.20GHz, RealTek audio) and there's no audio cracks and pops at all.

I assume you've tried changing Audio Latency in the audio settings. Do you have any audio device connected to your system, like DJ or audio equipment? Any audio app/plugin that could get in the way? Some users have reported issues with some equipment and audio apps.

Are there settings on your sound card that could be related to the issue?

prietveld commented 2 years ago

Thanks for your reply! No, the audio latency slider did not have any effect unfortunately, I tried both minimum and maximum values.

There is no special software running or audio equipment attached (besides a standard USB microphone?), but there is of course Creative's somewhat typical Soundblaster driver that is required for the card to function. That said, I haven't had similar problems elsewhere.

My W10 install is a 100% fresh install by the way, with drivers being the only software installed that's not 'out of the box', and the same problem exists there as it does on my W7 install.

Can you still offer that last debug version? At least I can confirm if the problem indeed isn't present there. And let me know if any log files or other info can help. I'm not going to overhaul my system for this, but I'd be happy to test a few things.

flyinghead commented 2 years ago

Unfortunately I don't have an offline archive of old builds.

You said the sdl2 default volume was "very loud and boomy." It should be at the same volume level as DirectSound as the audio signal is exactly the same.

prietveld commented 2 years ago

Not sure what to say. SDL2 is clearly louder, and to my ears a bit clipped because of it (but that could be subjective). Here are two recordings of Stupid Invaders, all I did in between was switch audio backends. You can hear the pops and clicks reported earlier in the DX recording as well by the way.

recordings.zip

flyinghead commented 2 years ago

Very different sounds indeed. The SDL2 and DX drivers are probably using different routes or devices.

The DirectSound driver uses the system-wide default audio playback device. Not sure which one SDL chooses by default.

prietveld commented 2 years ago

Different in software only then, as there is only one physical sound card present in my setup.