Can't get audio to sync in PS2 emulators

I’ve posted about this problem in a couple places, including the PCSX2 forums, and I haven’t gotten a lot of help. I’ll copy/paste what I wrote.

I’m on openSUSE Tumbleweed Linux, using the 1.5.0~git20191208 version of PCSX2.

Several months ago I noticed when I tried playing games in PCSX2, the audio is lagging. This is with the default SPU2-X settings (PortAudio, ALSA, TimeStretch, 300ms Latency). I notice the lag most when I’m on the menus. I move the cursor and about a second later the sound effect plays. The audio remains lagged into gameplay, too. I tested this with Suikoden IV, Suikoden III, Final Fantasy XII, and Wild Arms 3.

If I turn the latency down to 15ms, the lag is more or less gone, but the audio suffers from skipping and distortion. I can set it to 50ms to get rid of the skipping and distortion, but even then there’s a slight, noticeable delay.

I’ve tried switching to SDL and PulseAudio, but that doesn’t seem to make any difference. I also tried running the Windows version of PCSX2 in Wine to see if that’s any better, but alas, it suffers the same issues.

My PC specs:

OS: openSUSE Tumbleweed Linux
CPU: Intel Core i5-7500 3.4Ghz
RAM: 8GB
GPU: NVIDIA GeForce GTX 1050 Ti 4GB (official NVIDIA drivers, up to date)

It is entirely possible it’s some configuration issue outside of PCSX2. I tried testing the games using the newer Play! emulator, both the stand-alone version and the libretro core. The stand-alone had the same audio lag as PCSX2. The libretro core, on the other hand, seemed to have the audio synced, but the framerate was worse (around 50fps), which resulted in both audio and video quality problems.

Thing is, though, I don’t experience audio issues with any other game or application. Not native Linux game or games running in Proton, or even other emulators such as Dolphin or any other libretro cores (including Beetle PSX HW and PPSSPP). It seems to be exclusive to PS2 emulators, which makes zero sense to me.

It might be worth noting that I’m using the AppImage version of Play!, as that’s the only format the Automated Linux Builds are provided. I tried searching for it on OBS, but I had no luck.

… I booted over to Windows 10. I installed PCSX2 version 1.4.0 (the last stable version). The only settings I changed from the default were the controller mappings and setting the GPU plugin to use DirectX 11 (hardware) to render the video. The SPU2 plugin defaults to Xaudio2 with an audio latency of 100ms.

I tested Wild Arms 3, Suikoden Tactics, and Final Fantasy XII. All achieved perfect audio sync. Or at least good enough sync that I couldn’t notice any delay. Same exact computer as I tested on Linux with the 1.5.0 Git builds of PCSX2.

So, to summarize, PCSX2 and the AppImage version of Play! both suffer from rather bad audio lag on my Linux install. PCSX2 runs perfectly in Win10 on the same machine. No other Linux program appears to have any such issues with audio in any way. Could it possibly be a config issue somewhere? Could it be an issue with the PCSX2 plugin, and the Play! issues related to AppImage, thus being separate problems with the same symptoms?

It wasn’t until a while after I posted this that I noticed error messages in the PCSX2 Program Log window. Hopefully these can help track down the issue.

Opening plugins...
    Opening GS
    Opening PAD
    Opening SPU2
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 894
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 894
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 894
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 894
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 894
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
* SPU2-X: Enumerating PortAudio devices:
 *** Device 0: 'sysdefault' (ALSA)
 *** Device 1: 'front' (ALSA)
 *** Device 2: 'surround40' (ALSA)
 *** Device 3: 'surround51' (ALSA)
 *** Device 4: 'surround71' (ALSA)
 *** Device 5: 'speexrate' (ALSA)
 *** Device 6: 'pulse' (ALSA)
 *** Device 7: 'upmix' (ALSA)
 *** Device 8: 'vdownmix' (ALSA)
 *** Device 9: 'dmix' (ALSA)
 *** Device 10: 'default' (ALSA) (selected)
    Opening CDVD
    Image type  = DVD
 * CDVD Disk Open: DVD, Single layer or unknown:
 * * Track 1: Data (Mode 1) (2130176 sectors)
    Opening USB
    Opening FW
    Opening DEV9
McdSlot 0 [File]: /home/darthbrandon/.config/PCSX2/memcards/Mcd001.ps2
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
McdSlot 1 [File]: /home/darthbrandon/.config/PCSX2/memcards/Mcd002.ps2
Plugins opened successfully.

Your last post may have provided the info to track down your problem.
I suspect that the errors are related to the following, which apparently your app cannot “find” because there is no response on the UNIX socket it’s using…

https://en.wikipedia.org/wiki/JACK_Audio_Connection_Kit
https://wiki.archlinux.org/index.php/JACK_Audio_Connection_Kit
https://jackaudio.org/faq/

In fact, your problem might be simply not installing the correct version of JACK
https://github.com/jackaudio/jackaudio.github.com/wiki/Q_difference_jack1_jack2

You seemed not to have posted your entire log file, I’d expect that somewhere there is likely an explanation for why you’re getting any kind of audio at all, some kind of fallback is being used (maybe a direct ALSA connection without JACK?).

To verify the problem,
I’d probably try to find related PS/2 documentation (If you’re in touch with PS/2 developers, maybe they can provide that info) and then try to match with instructions in the JACK documentation for reading PiDs.
Or, try to find out which version of JACK you have installed and then try to find a solution for installing the other.

TSU

Recently i’m also facing this issue on PS2 Emulator, The main problem is audio lag is significant and there is no way to fix audio lag in Guitar Hero. and they were eventually able to get some PS2 games to the loading screen. regards - wefbee app and Team

I’m also using PS2 Emulator and same issues and recently i’m using Myboy free emulator it’s good for playing games with high quality visuals.