uraran / genplus-gx

Automatically exported from code.google.com/p/genplus-gx
Other
0 stars 0 forks source link

Random audio inconsistencies #196

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

This is a very rare issue that I wasn't able to reproduce, but since I 
experimented this three or four times on different occasions (with different 
games), I thought that maybe it's worth to report.

Sometimes I notice that the game will drop below 60fps. And it's not a slowdown 
of the game itself, since the music also becomes a little jerk. So, I have the 
impression that, for a brief moment, the emulator can't keep the framerate 
stable at 60fps.

As I said, it happens randomly and I wasn't able to reproduce it. I was playing 
"The Revenge of Shinobi" in the past 3 days and only one time I noticed this 
problem (playing the China Town level, and just during a few seconds). 

I'm not sure if anybody else notice the same problem. It happens rarely and 
only for a few seconds, so it could be unoticeable to most people.

Maybe if there was a framerate counter it would be easier to spot this issue.

I'm using NTSC (TV, Wii and rom) and 240p video mode.

Original issue reported on code.google.com by thiagoalvesdealmeida@gmail.com on 21 Dec 2011 at 2:19

GoogleCodeExporter commented 9 years ago
I really doubt the emulator cannot handle full framerate in all situations, 
especially with the performance I measured on some games which were above 2x or 
3x the expected framerate when removing the frame limit (i.e emulator running 
without waiting for sync). 

Also, the fact Virtua Racing, which requirements have no equivalents with any 
genesis games (since it requires emulation of an additional CPU), is running 
fullspeed, tells me that that it would be illogical that a normal genesis game 
is taking too much cpu to emulate. 

Finally, the fact it is not reproductible (i personally never experimented such 
frame drop) tells that this is not related to emulation of a specific part in a 
specific game which would require too much CPU time, otherwise it would happen 
everytime at the same spot.

Honestly, if this is not a huge slowdown but more an impression that it dropped 
from 60 to 58 fps, i think this is just what it is, an impression.

Othetwise, it might be related to the way the emulator is syncing itself: it is 
designed in a way that not a single frame should be missed (not even a few ones 
periodically like it is the case with most emulators on PC) neither any audio 
samples skipped. This requires very precise synchronization with Wii video AND 
audio hardware, while involving special techniques to keep multiple sound chips 
emulation in sync. As with all such stuff, there are approximations, and it's 
possible that in some very specific and rare cases, the synchronization fails 
and either accidentally slowdowns the emulator or fuck up the audio (as seen in 
another open issue i cannot reproduce).

The sync method is a little bit different when the emulator and Wii are running 
at different framerate (e.g emulating a NTSC genesis on a PAL Wii with TVMode 
forced to 50hz or the contrary), in the sense that emulation is now synced with 
audio hardware only, since a few frames are going to be dropped anyway. Since 
you have a NTSC Wii, you could first try to force Console Region to EUROPE, TV 
Mode to 60hz and see if you can reproduce heavy slowdowns.

Original comment by ekeeke31@gmail.com on 21 Dec 2011 at 5:08

GoogleCodeExporter commented 9 years ago
Yes. To tell the true, it seems more like a syncing issue, and not a perfomance 
problem. Could be also only an impression, I don't know... I only reported this 
because I had the same impression more than one time. And to be more precise, 
what catch my attention was the sound (a bit jerky for a brief moment). I can't 
say if there was any problem with the video.

So, IF this is a real issue, it certainly related to syncing method. But since 
this is very rare... it's definitely not worth investigating.

I tried to reproduce the problem, but with no luck. Maybe it only happens after 
a certain amount of time and/or with some rare scenarios. Can't say.

Thanks for clarifying that.

Original comment by thiagoalvesdealmeida@gmail.com on 21 Dec 2011 at 10:45

GoogleCodeExporter commented 9 years ago
By the way, I just noticed this issue again. It was definitely only a cracking 
in the sound - but I'm certain I heard it.

Original comment by thiagoalvesdealmeida@gmail.com on 22 Dec 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Well, that won't help me much fixing something I cannot reproduce on my side.

Actually, I spent quite a lot of time fixing video skipping / audio crackling 
and even if there aren't perfect solutions to this very sensitive subject that 
is synchronization with asynchronous hardware, I am quite satisfied with the 
current result.

So, considering the issue ihappens completely randomly and very rarely, is 
apparently barely noticeable or at least obviously tied a lot to user's 
appreciation, I don't think I'm gonna spend any more time on this unless it's 
really spoiling emulation experience.

I leave the issue open though, so that other people might eventually join in 
with more usable inputs.

Original comment by ekeeke31@gmail.com on 22 Dec 2011 at 6:52

GoogleCodeExporter commented 9 years ago
OK. I agree with you. It's not worth the trouble. Maybe it would be better to 
change the title of the issue, to reflect what it really is: a ocassional audio 
crackling.

Original comment by thiagoalvesdealmeida@gmail.com on 22 Dec 2011 at 7:53

GoogleCodeExporter commented 9 years ago
Just to add more information... I think this problem is not as rare as I 
thought. I don't play very often, but sometimes, when I take a few hours to 
play, I notice the audio crackling.

I was playing Shinobi III yesterday without problem. But today, I noticed a 
ugly audio crackling that lasted for 4 seconds.

So, I would say I come across this problem often, considering that I don't play 
that much. It only happens in the last stages of the game (and not always, of 
course), so I would say it takes some time to happen.

Original comment by thiagoalvesdealmeida@gmail.com on 23 Dec 2011 at 2:30

GoogleCodeExporter commented 9 years ago
Well, I'm saying it's rare because I cannot reproduce it, because the 
audio/video code did not change since version 1.4.O (more than one year old !) 
and I only got 2 issues report on that matter so far so it could as well be 
specific to your setup or an hardware inconsistency ;-)

Although, if you have Low-Pass filter enabled, you could try to disable it 
since I remember noticing that in some situations it will result in temporary 
garbled sound for an unknown reason, probably a bug or a limitation of the 
filter code I'm using.
Anyway, it's generally a good idea to give the emulators settings 
(System,Video,Audio) you are using when reporting an issue, since it gives me a 
better seeing of the situation. Also helps if you try to reproduce the issue 
with different setups, by changing key settings like High-Quality FM, 
Audio/Video filters, Render Mode, TV Mode, Borders, Console Region, etc...

Original comment by ekeeke31@gmail.com on 23 Dec 2011 at 4:27

GoogleCodeExporter commented 9 years ago

Original comment by ekeeke31@gmail.com on 23 Dec 2011 at 4:27

GoogleCodeExporter commented 9 years ago
I have a similar thing happen with consistency in Sonic 3. You know how in some 
areas, having water on the screen makes the game flash some garbled graphics? 
Whenever that happens, the music seems to stall for a split second. The 
graphics thing happens on real hardware, but the music stays consistent and 
doesn't seem to skip. I have the latest release of the emulator, with all 
default settings, and I'm playing on an old CRT TV for emulation purposes. I 
wasn't sure whether to start a new issue about this, since it may be related to 
this one. 

Original comment by Ice...@gmail.com on 23 Dec 2011 at 5:20

GoogleCodeExporter commented 9 years ago
I'm using the default audio settings (filtering is off). Like I said, I'm using 
the Original video mode, and I always play at 60hz (using NTSC roms).

Trying to reproduce this issue with different setups is unviable, since it's 
very randomly and it would take a massive amount of time to test. I also know 
it almost impossibile at this point for you to fix it, since it's not easy to 
reproduce the bug - but it's a good thing to leave this issue open. Maybe some 
else can provide a better feedback. 

But next time I play something, I will try to use Mednafen-wii to see if 
something wrong happens there.

Original comment by thiagoalvesdealmeida@gmail.com on 23 Dec 2011 at 5:29

GoogleCodeExporter commented 9 years ago
Mednafen-Wii probably uses a totally different interface for audio/video 
backends & sync so this won't help much. Also it's based on an older version of 
genesis plus which my current code has quite nothing more in common with. 
Anyway, I bet this is not an issue with emulation core or it would happen every 
time at the same spots, since emulation is quite deterministic.

@Icedus: this seems different as you said it happens everytime you reach that 
spot. Could you upload a savestate so I could try reproducing it when i have 
some time.

Original comment by ekeeke31@gmail.com on 23 Dec 2011 at 10:40

GoogleCodeExporter commented 9 years ago

Original comment by ekeeke31@gmail.com on 17 Jan 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Just to add more information... I also noticed this problem with a Master 
System game.

Original comment by thiagoalvesdealmeida@gmail.com on 22 Jan 2012 at 8:25

GoogleCodeExporter commented 9 years ago
Fantastic, thank you for this very detailled information :-/
Could you at least give the name of the game or describe what happened exactly 
and when ? 

Original comment by ekeeke31@gmail.com on 22 Jan 2012 at 9:59

GoogleCodeExporter commented 9 years ago
It's the same issue I told you before. It's an audio crackling that happens 
randomly, most likely after the game is running for a while. It sure sounds 
like a sync problem, like Snes9x or Fceux had before it was fixed.

The game is Zillion (but it certanly happens with every game). When you have 
the time maybe you should play it until the end. Nice game. It will take 
sometime to beat it in one sit since there is no password, but it will probably 
give you the opportunity to hear the problem, since you will be listening to 
the same music for a long time.

My opinion is that maybe you should rethink the syncing method. Pushing 
slightly more than 48000 samples with Fceux fixed it's problem.

Original comment by thiagoalvesdealmeida@gmail.com on 23 Jan 2012 at 12:44

GoogleCodeExporter commented 9 years ago
I am not going to change the sync method for something that i never noticed on 
my side the whole time i tested the emulator and that you barely can't give 
details on how to reproduce since it seems inconsistent, rare and 
game-independant...

And no, it's not the same issue as  other emulators and i already do the 
adjusted samplerate thing. Also i think the issue with those emulators was much 
more noticeable and repetitive. 

Anyway, next version will provide an option to disable VSYNC and let emulator 
synchronize with audio hardware only like it does when TV mode does not match 
emulated video mode, which should fix any audio inconsistancies you are hearing.

Something you didn't mentionned: does the glitch you hear disappear by itself 
after a while (without you entering the menu or reinitializing game) ? In this 
case, how long is it hearable ? Isn't there anything consistent between 2 
occurrences (duration of sound glitch, time played before it happens, ...)

Original comment by ekeeke31@gmail.com on 23 Jan 2012 at 9:09

GoogleCodeExporter commented 9 years ago
The glitch disappear by itself after about 2 seconds. 

About the consistent of the occurrences... They happen after playing for a 
while and I had the impression that sometimes the duration of sound glitch is 
longer than others occurrences, but I'm not sure.

I know that I should had provided more info, sorry. Maybe I could try to record 
the audio or something.

Original comment by thiagoalvesdealmeida@gmail.com on 23 Jan 2012 at 10:26

GoogleCodeExporter commented 9 years ago
I'm getting buffer underruns with the sound in Shining Force II.  Usually, it 
happens after the emulator has been running for several minutes.

Original comment by danwe...@gmail.com on 12 Mar 2012 at 5:24

GoogleCodeExporter commented 9 years ago
As already asked, please give the audio & video settings you are using and also 
what kind of wii you have (PAL or NTSC) if you want me to find where the 
problem might be. Since I cannot reproduce this issue in any of these games, 
even when letting them run for hours, any informations you can provide is a 
plus, including video recording of the issue when possible.

Original comment by ekeeke31@gmail.com on 12 Mar 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Here is a test version which logs audio/video timings and might help figure 
what is going wrong on your setup. 

1) first make sure VSYNC option is set to AUTO in VIDEO settings then run the 
game until the issue is reproduced. When this happens, return to main menu. 

2) Set VSYNC to OFF and run the game again for a few minutes, then go back to 
main menu. Normally, audio issue should not happen with VSYNC being OFF since 
emulation is synced with audio hardware this time.

3) grab the log files from the root of your SD card or USB drive and upload 
them here.

Original comment by ekeeke31@gmail.com on 12 Mar 2012 at 9:52

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 192 has been merged into this issue.

Original comment by ekeeke31@gmail.com on 12 Mar 2012 at 10:33

GoogleCodeExporter commented 9 years ago

Original comment by ekeeke31@gmail.com on 12 Mar 2012 at 10:35

GoogleCodeExporter commented 9 years ago
I've managed to reproduce the problem in version 1.6.0. by just leaving a game 
running for exactly 30 minutes... But then I left the test version for 50 
minutes and the problem didn't happen!

I'll do some longer tests just in case, but it seems that eke couldn't 
reproduce this bug because it's already been fixed.

-ICEknight

Original comment by superballena on 29 Jun 2012 at 12:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
That doesn't necessarily mean i fixed it, because as already seen by previous 
people, the issue is very inconsistent and random, to say the least, and i 
personnally never reproduced it, even on 1.6.0. I just added an option to force 
vsync off in that test dol and that would be normal you don't get any issue 
when it's off since the sync is different then.

Anyway, even if you can't reproduce it with VSYNC set to AUTO as stated in 
comment 20 instructions, it's still interesting to know about the console 
timings in both sync methods, which sadly, nobody has been bothered to post 
yet...

Original comment by ekeeke31@gmail.com on 29 Jun 2012 at 6:31

GoogleCodeExporter commented 9 years ago
I think I've found what triggers the problem in the 1.6.0 version.

If you're using the default settings, the sound problem won't appear (at least 
in half an hour), but if you're using the NTSC filter (I was using 
"composite"), the sound will start to crackle after 30 minutes.

I'll try the test version later, but I think it doesn't show the problem even 
with the filter applied. Even if I can't hear any faults in the sound, shall I 
try both the "Vsync auto" and the "Vsync off" modes for half an hour each, then 
close the emulator for the log to be saved properly?

-ICEknight

Original comment by superballena on 30 Jun 2012 at 2:11

GoogleCodeExporter commented 9 years ago
Here's the logs I got in the SD card, after all the tests. I guess I should do 
"50Hz, No Vsync" next?

-ICEknight

Original comment by superballena on 30 Jun 2012 at 3:15

Attachments:

GoogleCodeExporter commented 9 years ago
Note: I didn't get the sound problem in the test version, using those video 
combinations.

Original comment by superballena on 30 Jun 2012 at 3:37

GoogleCodeExporter commented 9 years ago
So here's the log for "50Hz, no vsync".

For the record, Rolling Thunder 2 is possibly one of the best games for testing 
the audio and video syncronization errors.

The caracter select screen shows some blinking stuff that makes it very easy to 
catch any missing frames, and then the sound test can play every song in the 
game one after another (great for some variety while doing 30+ minute tests), 
and it's pretty easy to notice any anomalies that might occur in the 
instruments used.

Original comment by superballena on 30 Jun 2012 at 4:05

Attachments:

GoogleCodeExporter commented 9 years ago
Oh, and no sound problems in this last test, either.

-ICEknight

Original comment by superballena on 30 Jun 2012 at 4:05

GoogleCodeExporter commented 9 years ago
Thanks.
 I do not see anything different than i already measured though.
Well, i guess i will leave this open for now and wait for feedback once the 
next version is released...

Original comment by ekeeke31@gmail.com on 30 Jun 2012 at 8:20

GoogleCodeExporter commented 9 years ago
I'm not sure if there should be any sound glitches but I could reproduce one on 
latest 1.70 genesis plus and loading virtua racing.
I am not too familiar with the game and how it should run but if I just let it 
play the demo on title screen there is a point I believe after about 30sec to 
1-2 mins where you kinda feel the emulation skips or slips up. The sound kinda 
buckles but not for more than a few seconds and its sort of like it crashes 
into itself.. then recovers. Happens in the same point each time so this maybe 
helps, maybe normal or maybe just my problem (I hope not).

I'm using 1.7.0 version.
I have a pal wii on component cables, settings in genesis plus on auto, vsync 
auto.
I'm using the NTSC roms.
I load using "Bios" and I have bios.md TMSS inside bios directory if this 
matters or is correct.

(Don't know if its related but only problem apart from the above, I have 
noticeable tearing or corruption underneath my sonic sprite in sonic 2. I see 
it on the first stages straight away. The graphic distorts in horizontal bars 
and its striking. I will test this more and create another issue but I wondered 
whether the pal wii running NTSC had a problem, never noticed it look bad 
before on 1.60.)

Original comment by dizin...@gmail.com on 3 Jul 2012 at 3:28

GoogleCodeExporter commented 9 years ago
You mean the bridge part ? It's more related to the fact that virtua racing 
needs lot of CPU power to be emulated and this would be the result of skipped 
frame. Although, this demo mode  is my "benchmark" which i check before each 
release to ensure i did not made unoptimized changes and i remember it was 
working fine with no sound skip. Maybe you are using NTSC filter in which case 
it is expected, as those are the 2 slowest things in this emulator.
I cannot repeat issue with sonic 2,  are you sure you are not using a filter. 
If you post your issue, don't forget to indicate what system, video and audio 
settings you are using.

Original comment by ekeeke31@gmail.com on 3 Jul 2012 at 3:54

GoogleCodeExporter commented 9 years ago
Uh oh... Just got the latest stable release and I'm getting the sound bug after 
5 exact minutes, with the NTSC filter enabled.

I'm testing without filters as of right now.

Original comment by superballena on 3 Jul 2012 at 5:15

GoogleCodeExporter commented 9 years ago
Right sorry I didn't provide more info previously... 
Genesis Plus 1.7.0
Its set to video progressive 60Hz, VSYNC Auto, Most system settings are on Auto 
those like PAL/NTSC,etc.
I have all filters turned off and all other settings on defaults.
I load off the SD card and have all the bios files in the folder and set to use 
bios only when loading. 
Interesting to hear that the NTSC filter is processor heavy because I was 
interested in it and had been checking the different settings with sonic etc.
I'll check this again making sure the NTSC filter is off.
The sonic thing is weird but in system settings I'm stuck with the hot swapping 
option enabled, I cannot switch it off for some reason, maybe this is the 
problem.

But yeah yesterday after I updated the sound thing was evident and I thought 
best to mention this. Thank you for such a quality emulator though, really 
appreciate the attention shown to the details and I hope I can help somehow 
where I can.

Original comment by dizin...@gmail.com on 3 Jul 2012 at 5:34

GoogleCodeExporter commented 9 years ago
Forgot the audio settings were the defaults, on high quality and I changed 
nothing in the options.

Original comment by dizin...@gmail.com on 3 Jul 2012 at 5:35

GoogleCodeExporter commented 9 years ago
There is indeed a bug with cart hot-swapping option, where it get stuck to ON 
once touched. However it shouldn't have any effect, only that you can't see if 
it is disabled or enabled but it's still switching when you hit the button.

Original comment by ekeeke31@gmail.com on 3 Jul 2012 at 8:07

GoogleCodeExporter commented 9 years ago
Okay, so with the default settings and no filters applied, the sound bug has 
appeared after leaving a game (specifically Rolling Thunder 2's sound test) 
running, at 13:20 and 23:40, in three consecutive tests.

Hope it helps.

Original comment by superballena on 3 Jul 2012 at 10:03

GoogleCodeExporter commented 9 years ago
Oh, and the next time the desynchronization happens is at 33:50.

Original comment by superballena on 3 Jul 2012 at 10:13

GoogleCodeExporter commented 9 years ago
Seems to be quite regular, i will try to reproduce it thanks.
 In the mean time, could you test again with the test dol posted in that thread and post timing results ?

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 6:29

GoogleCodeExporter commented 9 years ago
Sure, which settings do you want me to check this time?

Original comment by superballena on 4 Jul 2012 at 8:21

GoogleCodeExporter commented 9 years ago
Just the same default settings with which you reproduced the issue in that 
game, first with VSYNC in AUTO (default) until it first happen at 13:20 then 
with VSYNC OFF for approx. the same amount of time.

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 8:53

GoogleCodeExporter commented 9 years ago
@dizineUK: try reducing the value of SVP cycles in system settings and see if 
that helps
The issue with sound is definitively not the same as the ones described here 
and are caused by emulation slowdown (i've experimented this before while beta 
testing "optimizations": emulator takes too much time to update one frame, 
including sound frame and this causes the audio hardware to reuse the previous 
frame when it's over, hence garbled audio). I'm pretty sure i tested the US 
version with default SVP cycle value (800 i think) just before the release and 
the whole title screen demo played without any skipping.

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 1:38

GoogleCodeExporter commented 9 years ago
Now that I think of it... The long tests I run on the test version posted in 
this thread came up with no errors regardless of the filter settings, so it 
might be something that was changed between that version and the latest release.

Or did you mean trying a new test dol posted somewhere else?

Original comment by superballena on 4 Jul 2012 at 1:45

GoogleCodeExporter commented 9 years ago
As far as i remember, nothing was changed regarding audio since the last test 
dol i uploaded here.
If you really can't reproduce it in that game using this test dol while it is 
consistent with last version, i might post another test dol based on current 
version with logged timings enabled (it's just an option to activate in the 
Makefile).

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 2:15

GoogleCodeExporter commented 9 years ago
Ok, I'll try it again just in case when I get home and let you know.

Original comment by superballena on 4 Jul 2012 at 2:25

GoogleCodeExporter commented 9 years ago
@ekeeke31
I'll try reducing the SVP cycles value, this is the first time I've ever 
noticed anything wrong.

I can't be sure there is a problem I just feel like something isn't quite right 
(sonic2 horizontal tearing thing?) but maybe I should try the test dol based on 
this version too.

Original comment by dizin...@gmail.com on 4 Jul 2012 at 3:50

GoogleCodeExporter commented 9 years ago
So I've tried the test version with the default settings and, again, no sound 
bugs whatsoever (I left it for 15 minutes this time).

The latest release keeps showing the problem at around 2:40, 13:20, 23:35 and 
33:50 (default settings, as well).

Original comment by superballena on 4 Jul 2012 at 6:32

GoogleCodeExporter commented 9 years ago
Damn, that's weird, I don't have the exact code on which this was based anymore 
but I am pretty sure there wasn't any difference in regard to audio sync. Only 
difference I think it was compiled with an older version of libogc/devkitPPC. 
Please try this test dol then, it's based on current version and should logs 
timings to the root directory.

One question though: are you by any chance using a background ogg music with 
the emulator ?

@dizineUk: i cannot reproduce your tearing issue with sonic 2 but i can't 
output progressive video anyway and it looks like a filtering issue for me 
though I can't really visualize what you are exactly experimenting so unless 
you could make a video capture, there is nothing I can do. What am i sure 
though is that both issues have nothing to do with the one described in this 
section.

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 7:41

Attachments:

GoogleCodeExporter commented 9 years ago
@dizineUk: i reproduced the issue you were having with Virtua Racing, it indeed 
has garbled audio for a few sec if I use INTERLACED video mode instead of 
ORIGINAL. It's probably because the minimal framerate in this mode is higher 
than in original mode (59.94 fps instead of 59.82 because interval between 
VSYNC is shorter) so if the emulation speed is very near that limit (which is 
the case in that part of the game), it might indeed skip a few frame and the 
result is always garbled audio since audio hardware is still running and 
requesting new samples at the exact same frequency...

Only solutions are to optimize the emulator or to decrease the number of SVP 
cycles executed per frame (800->700 for example). You could also try with VSYNC 
disabled but i doubt it will change much since the framerate in that case is 
still high (~59.92 fps).

Original comment by ekeeke31@gmail.com on 4 Jul 2012 at 8:32