agg23 / openfpga-NES

NES for the Analogue Pocket
GNU General Public License v3.0
193 stars 9 forks source link

Frequent Audio Popping #25

Closed BobsYurUncle closed 1 year ago

BobsYurUncle commented 1 year ago

Version (or build number)

0.3.1

Steps to reproduce

I'm experiencing audio popping while playing games. intermittently.

Can be heard portably on bootup but it's really noticeable when playing on Dock, using headphones.

Tested across a few games, can be most prevalent when booting into a new rom but it does persist during gameplay. Not an issue on the Spiritualized NES core.

Captured gameplay showing the issue:

https://youtu.be/zk8KOBJDYlk

Expected Behavior

No audio pop

Actual Behavior

audio pop

Additional Context

No response

agg23 commented 1 year ago

Woah, that's really bad. Is it reproducible? Can you open Jackel over and over again and have it continue to crackle?

BobsYurUncle commented 1 year ago

Woah, that's really bad. Is it reproducible? Can you open Jackel over and over again and have it continue to crackle?

yes indeed. happens every time I boot. Although it's less prevalent the first boot, becomes worse after 2nd and beyond oddly enough.

agg23 commented 1 year ago

Very interesting. Have you experienced this with other cores (say my SNES core)? I open Jackal and have no crackling whatsoever, and you're the first who's reported such an issue to me (out of like 10k people). I'm wondering if I'm doing something wrong that works in most cases, or if you have a hardware issue.

agg23 commented 1 year ago

If you completely turn off the Pocket, turn it back on, and only open my NES core, do you still hear the crackling? I'm wondering if another core you opened caused a problem.

BobsYurUncle commented 1 year ago

Well sucks to be me I guess. I will mention that I'm one of the few lucky folks who had an audio issue with their pocket at launch. A few of us had a very loud digital "squeak" as seen here:

https://youtube.com/shorts/4fNBONESn-A

Not sure if at all related. But Analogue did patch out this issue a few firmware's ago and I haven't experienced it since.

BobsYurUncle commented 1 year ago

Upon further testing, it appears that my Pocket just doesn't play nice with your cores.

I just downloaded and tested with your SNES and PC Engine cores. Both exhibit the same issue as NES on my Pocket..

If I power cycle or close OpenFPGA and then load one of your cores and a game, I might get one single audio pop at boot and then it mostly sound fine in game, the odd pop here or there. But upon subsequent rom boots, or if I change a game, it starts popping a lot like in the video I shared.

Luckily it's easy to test as it's repeatable and happens right away.

Every other core I've used does not exhibit this issue.

GB/GBC/GBA/NES/Atari from Spiritualized - No perceived issues in 200+ combined hours Genesis from Eric Lewis - No perceived issues in 4+ hours use Neo Geo from Mazamars - No perceived issues in 8+ hours use

If it's just my Pocket, then it is what it is. I wish I could be more helpful in understanding what's happening specifically with your cores but maybe it does have something to do with my previous audio issues.

BobsYurUncle commented 1 year ago

The plot thickens. I just tested on a second Pocket, one without any prior issues and I'm experiencing the same audio popping. Going to try cleaning/swapping SD card. Something is amiss here.

agg23 commented 1 year ago

I've reached out to Analogue to try to get some more info about this. Really weird that you're the first to report it. Even weirder is Eric's Genesis core uses my audio handling code, so there should be no difference between that core and my cores.

To confirm, you've noticed this in portable mode (Pocket only) on each of my cores? There's obviously less testing happening on the Dock, so it would make a little more sense if it was Dock only.

BobsYurUncle commented 1 year ago

To confirm, you've noticed this in portable mode (Pocket only) on each of my cores? There's obviously less testing happening on the Dock, so it would make a little more sense if it was Dock only.

Thank you for suggesting this, yes as it turned out you are mostly right. So first let me say please don't lose any sleep over this if I'm actually the only one experiencing these issues, but after my testing I find that very hard to believe.

I did more extensive testing in portable mode and while I do have popping on bootup, (which is why I reported it earlier) it actually does go away during gameplay. In docked mode, however, I have pretty constant, repeatable popping issues. I've whipped up a video that does more comprehensive testing because I want to give you as much information as possible:

https://www.youtube.com/watch?v=PaTj1kDkciA

To summarize:

agg23 commented 1 year ago

Thanks for looking at this in such depth.

Popping at startup

The single pop is an Analogue firmware issue. I am unsure why they haven't fixed this, but clearly it is somewhat difficult.

The multiple pops in portable mode when switching ROMs is probably an issue with my cores. I actually was surprised to hear about the multiple pops, but after testing it occurs for me as well. It does not happen with the SNES core, so it's possible that the faster ROM loading of NES (due to smaller ROMs) is part of the problem (which indicates that it may be partially Analogue's issue as well).

Question

Just to confirm, you do not hear any popping while portable except for the initial single pop, or the ~5 pops that occur when switching ROMs?

Popping during gameplay

Again, I don't have this popping at all. I realized I've never tested the Dock's audio, so I tried several things.

  1. With my standard audio setup that I use for the Super NT, the audio was very noisy and possibly aliasing. Not sure what exactly caused that, but it's possible that the 48kHz sample rate of the Dock is clashing with my PC audio (though I tried moving all of my audio chain to 48kHz and still had some issues).
  2. With my capture card, the audio is perfectly clean. You can hear it here https://www.youtube.com/watch?v=UFitaiW2yFQ (I apologize for the controller sounds at the beginning. I didn't mute my other audio sources in OBS).

Question

This then makes me curious about your HDMI chain. How are you capturing the HDMI signal? Have you tested a path that is Dock to TV, without any elements in between (no receiver/HDMI switcher)?

Spiritualized comparison

While unofficial, the Spiritualized cores are the Analogue cores (same bugs and mapper support). Obviously Analogue has way more knowledge about this than I do, so I'm not particularly surprised that they don't have this issue. I have reached out to Analogue to see if they can offer any advice.

Eric's Genesis comparison

This is super weird to me. Eric's Genesis literally uses my audio code, which of course is all of my cores. The only difference is NES uses unsigned audio, and Genesis uses signed, but SNES uses signed as well, and you've reported issues with SNES still.

agg23 commented 1 year ago

As an experiment, I am interested to see if you get any different results with this bitstream. I convert the audio to signed explicitly, which will make it twice as loud, and more similar to Eric's Genesis.

nes.zip

BobsYurUncle commented 1 year ago

Question

Just to confirm, you do not hear any popping while portable except for the initial single pop, or the ~5 pops that occur when switching ROMs?

Correct.

Question

This then makes me curious about your HDMI chain. How are you capturing the HDMI signal? Have you tested a path that is Dock to TV, without any elements in between (no receiver/HDMI switcher)?

Once again you were right, when I play games through my capture card I run it through a HDMI splitter for the sole purpose of stripping HDCP. I can't find the exact model but something basic like this guy:

https://www.amazon.com/HDMI-Splitter-Out-Aluminum-Supports/dp/B09KPRFQSL/ref=sr_1_36?crid=2VFGOMEG1QT8K&keywords=hdmi+splitter&qid=1670787924&sprefix=hdmi+splitte%2Caps%2C158&sr=8-36

There's about a thousand similar models, I'm sure they all have the same internals. I haven't had any issues with it before now, but when I removed it from the chain, the intermittent pops during gameplay went away. There still are audio pops on bootup across all your cores and they last for about 10 seconds, into the main menu and very start of a new game but then they do go away completely.

Then I took my Pocket over to the TV setup, which does have a 16 port HDMI switch. When I hooked it up, the audio matches exactly what you described. A few pops when booting a second time but then all good, and the SNES core had zero pops just like you said. So my TV setup appears to mirror yours exactly. It must have something to do with my capture card and then exacerbated by the HDMI splitter.

The capture card is the Avermedia Livegamer 4K. I did tests in both OBS and ReCentral to make sure it wasn't a software issue.

At least it appears we've narrowed it down, and if I circumvent the splitter, dealing with 10 seconds of popping audio isn't a huge problem. So the great news is people using these cores on their TV setups are probably having no issues. Hopefully Analogue can shed some insight but now I know how to largely avoid the problem at least. Thanks for the help troubleshooting.

BobsYurUncle commented 1 year ago

As an experiment, I am interested to see if you get any different results with this bitstream.

I replaced this with the one on my Pocket and did not observe any differences, it wasn't twice as loud either if that was expected. edit: It was a little louder actually

And out of curiosity I replaced your nes.rev file with the one found in Spiritualized core. While this breaks things, games no longer boot up, you can still hear multiple audio pops when switching roms.

agg23 commented 1 year ago

Here's a random thing to try: run this example core. It contains 2 different WAV files to pick from. See if you get crackling when loading that.

https://github.com/open-fpga/core-example-basicassets/releases

BobsYurUncle commented 1 year ago

Here's a random thing to try: run this example core. It contains 2 different WAV files to pick from. See if you get crackling when loading that.

https://github.com/open-fpga/core-example-basicassets/releases

Finally got a reprieve from work; I booted up this core and re-loaded the wav files multiple times and never experienced any issues or popping. Sounds perfect even going through HDMI splitter.

agg23 commented 1 year ago

Other than potentially being an audio filtering issue (a la #28), it seems like this issue might be localized to one device. Closing for now