hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.01k stars 2.15k forks source link

Random Audio Popping/Grinding in different games #15403

Open TheeDrewGamer opened 2 years ago

TheeDrewGamer commented 2 years ago

Game or games this happens in

First noticed in ULUS10560: Final Fantasy IV: The Complete Collection, but its affecting multiple games

What area of the game

I originally noticed this issue, when I entered the Town of Baron in Final Fantasy IV. I get many different popping sounds, but they appear to be random. There has been some issues with grinding audio as well, but not as much as the popping.

Speed seen in PPSSPP

100% (60/60)

GE frame capture and debug statistics

No response

Platform

Windows

Mobile phone model or graphics card

NVIDIA GeForce GTX 1660 Ti

PPSSPP version affected

All versions, no matter which I try

Last working version

No response

Graphics backend (3D API)

Direct3D 11

Any other notes or things you've tried

I've noticed this in different games I have tried, I can't seem to replicate when it happens. The audio will have random popping or grinding.

So far I've tried

This issue seems to have started out of nowhere as well, as I played both Final Fantasy and Final Fantasy IV last year. With no audio issues. Its just been in the last two days. I was using V1.10.3, I've tried V1.11 and V1.12.3, same issue with random grinding audio/popping. I have messed with different settings, to try and find a solution, Frame Skipping, different rendering backends, different audio backends, resetting to default settings. I also updated my Audio drivers, in case it was that.

I noticed that I am missing some Audio settings, that appear in versions I have. I don't see Audio Latency or Audio Sync, which I think might be a possible cause.

I can provide more details, if you need them!

I recorded a 2 minute video, to capture the issue as much as I could. The first time you hear it is around 57 seconds to 1 minute, then at 1:14, 1:54 and 2:00

https://youtu.be/-NkYgodUObo

Checklist

ghost commented 2 years ago

Did you try the latest build of ppsspp from buildbot?

TheeDrewGamer commented 2 years ago

Sorry for the delay, it was really late when I posted that, I tried the latest build from BuildBot. The issue is still occurring unfortunately.

I noticed that in the Arranged Soundtrack of Final Fantasy IV, it does it randomly but if I switch to the Original Soundtrack. It pops at exactly the same point in the soundtrack every time.

Is there any reason as to why I'd be missing the audio setting options for Latency and Sync? I feel like that may be causing the issue, but they don't appear for me. I followed some tutorials during my time trying to fix it, I thought they weren't in the version I had but even the ones above mine don't have those options. When they appeared for other people.

iota97 commented 2 years ago

Audio Sync is now always on: #12920.

Latency setting wasn't matching PSP behavious and should be now always be medium: #12804.

They got removed before 1.10.3 AFAIK and that's working for you, isn't it?

If you can reproduce everytime in that sound track you could probably bisect the issues to help us getting it fixed.

From the build bot download a working version: e.g. 1.10.3-xxxx and a not working one, e.g. 1.11.0-xxxx.

Now get a build in between, test it, if is working the problem started after that build, if not before.

Get a build in between the working and the not working one again and repeat until you narrow the range to a few of builds.

Knowing which changes caused the problem should greatly help :)

TheeDrewGamer commented 2 years ago

Audio Sync is now always on: #12920.

Latency setting wasn't matching PSP behavious and should be now always be medium: #12804.

They got removed before 1.10.3 AFAIK and that's working for you, isn't it?

If you can reproduce everytime in that sound track you could probably bisect the issues to help us getting it fixed.

From the build bot download a working version: e.g. 1.10.3-xxxx and a not working one, e.g. 1.11.0-xxxx.

Now get a build in between, test it, if is working the problem started after that build, if not before.

Get a build in between the working and the not working one again and repeat until you narrow the range to a few of builds.

Knowing which changes caused the problem should greatly help :)

Thank you for posting back Iota! I was confused because I saw a video with those settings in 1.11.

1.10.3 is the one I’ve been using for a long time, I haven’t updated the emulator, I might have even got it at that version and never updated. It’s been fine up until Saturday, and then the audio issues started. I then started testing ones above 1.10.3, because I saw those audio settings in that video I mentioned, so I thought they were there.

At the time it started, I hadn’t changed anything on the emulator, or my pc as a whole. It just suddenly started doing that.

iota97 commented 2 years ago

If it started like this it might be caused by some performance issues, you could enable the frame time graph to see if there are any spikes when it happen: Settings -> Tools -> Developer tools -> Show developer menu then from in game you will see the DevMenu button in the top left corner: DevMenu -> Draw frametimes graph.

I don't think there is much we could do tbh, might have been caused by a background update, your PC might be getting older or hotter by dust or weather. You may have more background program open than before and so on.

TheeDrewGamer commented 2 years ago

If it started like this it might be caused by some performance issues, you could enable the frame time graph to see if there are any spikes when it happen: Settings -> Tools -> Developer tools -> Show developer menu then from in game you will see the DevMenu button in the top left corner: DevMenu -> Draw frametimes graph.

I don't think there is much we could do tbh, might have been caused by a background update, your PC might be getting older or hotter by dust or weather. You may have more background program open than before and so on.

I'll give the frame time graph a go and see if anything shows up on it.

Its just weird its happened, because every thing else is fine, other games, emulators, capture card that are more labor intensive than PPSSPP. Some games are completely fine, Final Fantasy 1, Dissidia, Duodecim, I retried Star Ocean Second Evolution and thats fine.

Final Fantasy IV its literally just that one track, every other track is fine, FF2 and First departure its random. However as those were the 3 games I was going to record, its very frustrating that it had to happen. But thinking about it, Windows might have updated at some point last week. So it could have been caused by that because it was fine the week before.

Edit: Tested the Frametimes graph on FF4

unknownbrackets commented 2 years ago

If there are no spikes and this suddenly happened without any updates to the emulator, we're most likely looking at an external cause.

The first thing I'd suggest to validate that is to download a fresh zip version of PPSPP (it can be the same as the old one you were using, or the latest git) and put it in a new directory on your desktop. Don't copy over any settings, save data, save states - completely fresh. Now try running one of the games where the pops are most obvious early on (ideally in the intro.)

If it doesn't happen in this fresh and clean version, but does happen with your saves... then a setting or something to do with saves is likely involved.

Otherwise, we've effectively reset and it would seem likely that something outside PPSSPP is causing this. At that point, I'd recommend:

  1. Check for updates to your drivers: graphics, audio, USB/chipset, and any controllers you use. Windows Update does not always include the newest driver updates. There may have been a driver update that introduced a problem that only affects PPSSPP.

  2. Close PPSSPP, unplug all optional peripherals (including game controllers), and start it again and play using the keyboard. If the problem is gone, repeat with half the things plugged back in, until you find the one causing it. Check for driver updates for that device and reseat all cables/connections.

  3. Restart your PC, and quit as many startup apps as possible. If you're an advanced user, consider going into Services and stopping background services. Disconnect from the internet and disable your virus scanner temporarily. Now try to reproduce in PPSSPP again. If this fixes it, it may be from interaction with another program. Don't forget to resume your virus scanner and turn everything back on.

  4. Enable logging of frame drops in PPSSPP, display the console and play windowed at 1x with the log visible. See if anything gets logged as a framedrop while you hear the pops. Paste any logs here (you can right click the title bar of the console to select and copy.)

  5. If you're an advanced user, consider booting off a USB (or whatever works) to a Linux install, and see if it happens there with PPSSPP, as well.

-[Unknown]

TheeDrewGamer commented 2 years ago

If there are no spikes and this suddenly happened without any updates to the emulator, we're most likely looking at an external cause.

The first thing I'd suggest to validate that is to download a fresh zip version of PPSPP (it can be the same as the old one you were using, or the latest git) and put it in a new directory on your desktop. Don't copy over any settings, save data, save states - completely fresh. Now try running one of the games where the pops are most obvious early on (ideally in the intro.)

If it doesn't happen in this fresh and clean version, but does happen with your saves... then a setting or something to do with saves is likely involved.

Otherwise, we've effectively reset and it would seem likely that something outside PPSSPP is causing this. At that point, I'd recommend:

  1. Check for updates to your drivers: graphics, audio, USB/chipset, and any controllers you use. Windows Update does not always include the newest driver updates. There may have been a driver update that introduced a problem that only affects PPSSPP.
  2. Close PPSSPP, unplug all optional peripherals (including game controllers), and start it again and play using the keyboard. If the problem is gone, repeat with half the things plugged back in, until you find the one causing it. Check for driver updates for that device and reseat all cables/connections.
  3. Restart your PC, and quit as many startup apps as possible. If you're an advanced user, consider going into Services and stopping background services. Disconnect from the internet and disable your virus scanner temporarily. Now try to reproduce in PPSSPP again. If this fixes it, it may be from interaction with another program. Don't forget to resume your virus scanner and turn everything back on.
  4. Enable logging of frame drops in PPSSPP, display the console and play windowed at 1x with the log visible. See if anything gets logged as a framedrop while you hear the pops. Paste any logs here (you can right click the title bar of the console to select and copy.)
  5. If you're an advanced user, consider booting off a USB (or whatever works) to a Linux install, and see if it happens there with PPSSPP, as well.

-[Unknown]

I tested it with a completely fresh version of PPSSPP, it is happening a lot less often but its still happening.

Final Fantasy IV - I can get through the whole intro, I can walk around the castle, the world map, get into battles. No issue. Its as soon as I go into the starting town. That's when it starts happening.

Final Fantasy - Still perfectly fine

I'm going to make my way through the list now, how do I enable Logging of Frame Drops? I haven't been able to find it in the settings.

unknownbrackets commented 2 years ago

It's under Developer Tools in System.

If it's happening less with a fresh version - that's interesting. That might mean some setting is affecting the degree of it, which would be helpful to find. Could try adjusting settings in the fresh version until it matches.

-[Unknown]

TheeDrewGamer commented 2 years ago

It's under Developer Tools in System.

If it's happening less with a fresh version - that's interesting. That might mean some setting is affecting the degree of it, which would be helpful to find. Could try adjusting settings in the fresh version until it matches.

-[Unknown]

Thank you! I think I have it enabled now Developer Tools > Log Dropped Frame Statistics, and I've got log console open. I'll start it from when I enter the town and see if it updates during any audio issues.

Nothings popping up in the Log during any popping, the only time something appeared was when I accidentally put my controller down and the trigger got caught and sped up the game. Other than that, nothings appeared.

This didn't happen on an audio pop or stutter, but it just popped up while I was stood in the town doing nothing. Dropped 533 frames and went from 59.9 fps to 34.4fps.

55:08:883 MyThread-Sou N[SCEDISP]: HLE\sceDisplay.cpp:533 Dropping frames - budget = 16.68ms / 59.9fps, actual = 29.09ms (+12.41ms) / 34.4fps Kernel processing time: 3.73 ms Slowest syscall: sceGeListEnQueue : 3.66 ms Most active syscall: sceGeListEnQueue : 3.66 ms DL processing time: 3.65 ms Draw calls: 188, flushes 169, clears 1 Cached Draw calls: 0 Num Tracked Vertex Arrays: 0 GPU cycles executed: 37970 (37.378517 per vertex) Commands per call level: 159 4055 156 0 Vertices submitted: 782 Cached, Uncached Vertices Drawn: 0, 1152 FBOs active: 3 Textures active: 34, decoded: 0 invalidated: 0 Readbacks: 0, uploads: 0 Vertex, Fragment shaders loaded: 6, 6

Edit: I unplugged everything from my PC, except the Keyboard and tested that. It didn't do it for about 30 minutes, then it started doing it again, but not as frequently or as intense. I've updated my Graphics, Audio and USB drivers, and I've tested it with a bunch of programs closed and made sure nothing was loading upon start up. The log didn't show anything when the audio stutters and popping occurred.

I don't think I am able to do step 5 from your list. So I'm not sure what to do at this point. Its looking more likely to be hardware related, but its strange because everything else runs perfectly fine. I have no other issues with the pc, nothing else gives me audio or stuttering issues. And FF1 still remains perfectly fine. Its got to be something extremely specific, I just have no idea what.

unknownbrackets commented 2 years ago

If you don't get any frame drops logged, that's a good sign - it means nothing is taking long to produce frames. PSP games produce little bits of audio while rendering (it's all just intertwined), so this is a good sign that it's not some sort of performance issue.

You mentioned messing with settings, but did you try changing the Audio Backend to DirectSound? Sorry for not mentioning this earlier, if you haven't. It could help with certain drivers and audio devices.

Since the fresh install helped some, I'm not convinced this is just hardware... definitely a bit strange, though.

Generally speaking, as long as we're processing frames quickly enough, we should just be sending audio to either WASAPI or DirectSound, which should then get it to your hardware.

There's another thing we can try:

  1. First go to Settings -> Tools -> Developer tools.
  2. From there, check "Show developer menu" (third option.)
  3. Now run the game, and click the "DevMenu" button in the top left.
  4. Scroll down in the menu if needed, and select "Toggle audio debug".

You'll see some statistics, including actual sample rate (it won't be exactly 44.1kHz, under-runs, and over-runs. Both under-runs and over-runs can cause audible pops.

Normally, with your CPU/GPU, I would expect these numbers to be pretty stable. In my case, the audio buffer size (XXXX/4096) bounces around and goes to 2xxx sometimes, but never goes to 3xxx. Filtered pretty much stays between 1600-1800. Sample rate sticks around 44080-44120. The effective rates have the first 3 digits not really changing, but the rest bounce around.

Those are only my numbers and yours don't have to match. But things to watch out for:


From my perspective, since unplugging things only helped, but did not prevent the issue, it doesn't sound like this is being caused by some device (people have had such problems before.) And it sounds like closing programs didn't really help, so it's probably not something spiking and taking more power (I know some antiviruses have started to include bitcoin miners, etc.)

Do you have any alternate audio devices? For example, I have a DualShock 4 controller. When I plug it in, I can route audio through it and use its 3.5mm jack. This runs at a lower sample rate (32 kHz iirc), and it initially had issues that I had to fix. If we could try another device and it works, that might mean there's a problem with how PPSSPP is handling the sample rate of your primary device (though I think we've gotten pretty stable there...)

Sorry to give you so many different troubleshooting steps. Trying to get to that eureka moment where something has a clear "back to normal with this change," because then we'll know what to fix.

-[Unknown]

TheeDrewGamer commented 2 years ago

If you don't get any frame drops logged, that's a good sign - it means nothing is taking long to produce frames. PSP games produce little bits of audio while rendering (it's all just intertwined), so this is a good sign that it's not some sort of performance issue.

You mentioned messing with settings, but did you try changing the Audio Backend to DirectSound? Sorry for not mentioning this earlier, if you haven't. It could help with certain drivers and audio devices.

Since the fresh install helped some, I'm not convinced this is just hardware... definitely a bit strange, though.

Generally speaking, as long as we're processing frames quickly enough, we should just be sending audio to either WASAPI or DirectSound, which should then get it to your hardware.

There's another thing we can try:

  1. First go to Settings -> Tools -> Developer tools.
  2. From there, check "Show developer menu" (third option.)
  3. Now run the game, and click the "DevMenu" button in the top left.
  4. Scroll down in the menu if needed, and select "Toggle audio debug".

You'll see some statistics, including actual sample rate (it won't be exactly 44.1kHz, under-runs, and over-runs. Both under-runs and over-runs can cause audible pops.

Normally, with your CPU/GPU, I would expect these numbers to be pretty stable. In my case, the audio buffer size (XXXX/4096) bounces around and goes to 2xxx sometimes, but never goes to 3xxx. Filtered pretty much stays between 1600-1800. Sample rate sticks around 44080-44120. The effective rates have the first 3 digits not really changing, but the rest bounce around.

Those are only my numbers and yours don't have to match. But things to watch out for:

  • Underruns or overruns will increase if you fast forward or sometimes in loading screens, but should not increase constantly, or by more than 10-20 during a loading scene (even that is not ideal.)
  • The sample rate value should always be close to 44100.
  • The effective sample rates should stay largely consistent and should not change significantly (it's perfectly okay for them not to match each other or 44100, for example my output sample rate is approximately 48kHz.)

From my perspective, since unplugging things only helped, but did not prevent the issue, it doesn't sound like this is being caused by some device (people have had such problems before.) And it sounds like closing programs didn't really help, so it's probably not something spiking and taking more power (I know some antiviruses have started to include bitcoin miners, etc.)

Do you have any alternate audio devices? For example, I have a DualShock 4 controller. When I plug it in, I can route audio through it and use its 3.5mm jack. This runs at a lower sample rate (32 kHz iirc), and it initially had issues that I had to fix. If we could try another device and it works, that might mean there's a problem with how PPSSPP is handling the sample rate of your primary device (though I think we've gotten pretty stable there...)

Sorry to give you so many different troubleshooting steps. Trying to get to that eureka moment where something has a clear "back to normal with this change," because then we'll know what to fix.

-[Unknown]

Oh no you're absolutely fine! The more troubleshooting the better, because it might help narrow it down more. I'll try these out tomorrow, when I have free time and update you on anything that happens.

As for other Audio devices, the only thing I have is my headphones. I could try a different jack and see if that fixes it. I hear it both through my Headphones and through my monitor. It has in built speakers. I could try copy it over to a family members laptop, and see if it happens there. Its very old though, so it might have issues.

Other devices I have are my PS3 controller, wireless adapter, webcam, yeti microphone, ring light, and an Elgato (which I don't have connected unless I am recording through my consoles).

Edit: I recorded a video for you, to show you what its doing with the Audio Debug Menu open. When I loaded the game up it already said 32 Underruns, and it went up slightly over the course of the video. I made sure to set the Backend to DirectSound as well.

At 32 seconds, you will hear a pop. This always happens at that exact same point, every single time when using the Original OST. So I'm wondering if this is just a weird error when the track starts looping again? If I'd left it on, it would have happened at 1:04 as well.

With the Arranged OST, there was a lot of pops and stuttering audio, so hopefully this might help. Just so you can see what's going on with it.

https://youtu.be/x0eCWqUNbGM

JayanWarden commented 2 years ago

Audio is also underrunning and crackling in FF VII: Crisis Core on the Steam Deck, changing settings has no effect on the audio issue.

image

The game accumulates about 100 underruns every minute with the Steam Deck running stock and SoC pretty much idle.

sleeva1337 commented 1 year ago

I have the same issue - random sound cracklings in Patapon 2 on the latest version v.1.15.4. Tried different things - I found solution to change audio backend to DSound, but it messes up with latency in the game and it is really harsh. Tried to avoid this by switching backend from DirectX 11 to Vulkan and lowering buffer graphics commands to No buffer - game plays better but there still a minimal noticible imput lag (and in Patapon any imput lag makes game really unplayable). Restoring settings makes game playable but also brings back the crackling. Also tried updating sound drivers, but no luck there. I dunno what to do else :(

Windows 10 x64, RTX 2070Super, ryzen 5 5600x, 32gb ram

MolassesLover commented 6 months ago

Same issue on NixOS, running the latest Flatpak. Sometimes it disappears when I change a setting, like turning on fullscreen or Vsync, but it isn't consistent. Happens to me when playing Gitaroo Man Lives- haven't tried any other game.