greyes5 / genplus-gx

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

Random audio inconsistencies #196

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 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 8 years ago
Another possibility: VSYNC disabled + Master Clock forced to PAL, required 
framerate becomes 59.38 fps (that's actually the exact framerate of a PAL Mega 
Drive switched to "60hz")

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

GoogleCodeExporter commented 8 years ago
Not only I wasn't using any OGG background music, but I didn't know such a 
thing was possible until now...

The tests I run were made right after the emu showed a message of the default 
settings being reset (please check the PM regarding this at Spritesmind), and 
the only thing I did change was the ROM device from SD to USB.

I'll make sure to run some tests tomorrow and post them here.

Original comment by superballena on 4 Jul 2012 at 11:12

GoogleCodeExporter commented 8 years ago
Here's the logs from the new version. Surprisingly, I didn't notice any audio 
problems in 50Hz mode.

Original comment by superballena on 5 Jul 2012 at 4:00

Attachments:

GoogleCodeExporter commented 8 years ago
There is something weird in the ntsc log with VSYNC disabled: it seems like the 
interval between audio hardware interrupts is sometime zero, which is not 
normal. This could explain the garbled audio when VSYNC is enabled since the 
emulation is not synced with audio interrupts in that case and if that's still 
happen, well everything got desynced... this does not happen in the PAL logs.

Original comment by ekeeke31@gmail.com on 5 Jul 2012 at 7:48

GoogleCodeExporter commented 8 years ago
I just wondered about what you mentioned re: the interlaced video mode... 
because I use component cable and progressive that means video mode is 
interlaced? 
(please excuse me as I don't have my wii near me now)

I have settings on progressive, and output original or original (16:9), never 
ever interlaced.
My Wii is PAL and all the Roms are NTSC, so the ntsc log would only prove 
something is not working correctly on NTSC wii's? Or could PAL wii loading NTSC 
roms be effected?

Hopefully I'll figure this out but thanks for your help and advice and 
explanation. I appreciate it.

Original comment by dizin...@gmail.com on 6 Jul 2012 at 1:31

GoogleCodeExporter commented 8 years ago
No, it's just that timings used are the same in interlaced (480i/576i) and 
progressive (480p) modes. That'said, you could run the test dol with VSYNC set 
to AUTO in progressive mode and upload your logs so i confirm it.

NTSC/PAL log is related to the emulated console TV mode: if VDP mode is set to 
AUTO, NTSC roms will run with NTSC timings, even on a PAL wii. Wii TV mode must 
be set to AUTO so that Wii is configured to PAL60 and VSYNC is enabled (if 
emulated TV mode and Wii TV mode differs, VSYNC is always disabled when set to 
AUTO).

Original comment by ekeeke31@gmail.com on 6 Jul 2012 at 8:17

GoogleCodeExporter commented 8 years ago
Issue 233 has been merged into this issue.

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

GoogleCodeExporter commented 8 years ago
Sonic the Hedgehog 2 (MD/Genesis) has random audio crackling here. It seems to 
happen the most in the special stages. The issue does not seem to exist in 
1.6.0. I have tried both versions on two different SD cards. No settings seem 
to change anything regarding this issue.

Original comment by swsparkl...@gmail.com on 30 Jul 2012 at 6:16

GoogleCodeExporter commented 8 years ago
Try with vsync off, interlaced mode, hq fm disabled. These are the only 
settings that could eventually change behavior. Anyway, i cannot reproduce your 
issue, as usual. 

Original comment by ekeeke31@gmail.com on 30 Jul 2012 at 6:23

GoogleCodeExporter commented 8 years ago
Strange, I thought I had tried everything. Here's what I've seen just now:

Vsync off, interlaced mode, hq fm disabled: No issues
Vsync off, interlaced mode, hq fm enabled: No issues
Vsync off, progressive mode, hq fm enabled: No issues
Vsync on, progressive mode, hq fm enabled: Crackling sound issue

I guess I could keep Vsync off since it's not as bad as it can be with other 
programs. The video is not as smooth as it is with Vsync turned on, but at 
least turning Vsync off here doesn't cause the kind of tearing you sometimes 
see with PC games. I'd still prefer it if this could get fixed somehow though.

Did anything outside of Genesis Plus GX change that could affect this? Does 
1.7.0 use a newer version of libogc? Could IOS/CIOS versions affect anything? 
Are there any differences in the Wii's audio hardware between different models?

Original comment by swsparkl...@gmail.com on 30 Jul 2012 at 7:01

GoogleCodeExporter commented 8 years ago
I really doubt you can notice a smooth difference by turning Vsync OFF, it's 
more a placebo effect or something because you know what VSYNC is supposed to 
do on PC emulators. The only thing you could eventually notice is a single 
frameskip after some period of time (like many seconds) but again, it would 
only be noticeable in a few games that would for example scroll the screen by 
one pixel on each frame and if your eyes are trained enough to detect 16.7ms 
transitions ;-)

It has NOTHING to do with libogc, IOS or any other crap like that. It's 
definitively related to the sync method I am using, which is used to get 
perfect sync with video AND audio hardware, hence why it works fine when VSYNC 
is disabled (in this case, only audio sync is done). Most emulators don't take 
care of this because it's very difficult to achieve and requires using exact 
timing of the host hardware (video AND audio rates), any subtle variations 
causing the desync you are experimenting.

I am actually trying to change the way sound chips are synchronized together at 
the end of emulated frames (which changed from 1.6.0) since it could also cause 
some deviation in the number of samples rendered on each frame and lead to 
possible desync with the audio hardware when vsync is used. We will see if it 
works better for sensitive Wii like yours (again, the problem is also that I 
cannot reproduce any of these issues, even when leaving games playing for hours 
with vsync on).

Original comment by ekeeke31@gmail.com on 30 Jul 2012 at 7:23

GoogleCodeExporter commented 8 years ago
Issue 269 has been merged into this issue.

Original comment by ekeeke31@gmail.com on 6 Aug 2012 at 7:17

GoogleCodeExporter commented 8 years ago
If everything goes as expected, I'll be recording the Wii's audio directly 
through the line-in port on my PC, which should result in audio files with 
quite good quality. It'll take at least a couple of days though as I have to 
obtain the cables first.

Original comment by swsparkl...@gmail.com on 6 Aug 2012 at 9:20

GoogleCodeExporter commented 8 years ago
Here's Sonic 2. I recorded all the way through the first two stages, both acts. 
First special stage begins at 02:00. Second special stage begins at 07:20.

Original comment by swsparkl...@gmail.com on 10 Aug 2012 at 10:29

Attachments:

GoogleCodeExporter commented 8 years ago
And here's Sonic 3. I recorded all the way through the first stage, both acts. 
The first chaos emerald special stage begins at 00:46. The second at 
03:11.Third at 05:54.

The issue is more noticeable in Sonic 2 though. In both games there's some kind 
of "audio crackling".

Original comment by swsparkl...@gmail.com on 10 Aug 2012 at 10:37

Attachments:

GoogleCodeExporter commented 8 years ago
Perhaps this could be caused by the PAL 60 mode running at a very slightly 
different speed than NTSC?

Original comment by iceknigh...@gmail.com on 7 Sep 2012 at 9:25

GoogleCodeExporter commented 8 years ago
Perhaps. But then I wonder why it has to run in PAL 60 mode in the first place. 
I don't think there is any TV today that can't handle NTSC.

Original comment by swsparkl...@gmail.com on 7 Sep 2012 at 12:11

GoogleCodeExporter commented 8 years ago
It has nothing to do with what TV support or does not support: PAL Wii can only 
output PAL60, not NTSC and NTSC Wii only output NTSC, obviously. So there is no 
"choice", when using a 60 hz TV mode, you are bound to what mode the console 
support, not the TV.

Anyway, from the timings that were uploaded, there is no difference between 
PAL60 and NTSC, and report has been made by PAL wii owner when i also own one.

Now, i finally have noticed the issue in one game on my side and the issue is 
also consistent with sega Cd games that use PCM. It's also clear it is an audio 
syncing issue as it does not happen when vsync is forced off.
 I have completely rewritten the way sound chips are synced together which affect the number of samples output on each frame since i think the change i did between 1.6.0 and 1.7.0 was not so good.
Also plan to increase the number of buffers (double-buffering might be a little 
too restrictive if the timing is not "exact" as it does not allow any miss). 
Still need to test if this fixes the one game where i noticed the issue. Does 
not fix PCM issue (in Lunar 2 for example) though.
So next round will be rewriting the main emulation syncing method to allow 
synchronization with both video and audio in a non-blocking way. Let's hope it 
will solve all these issues for good.

Original comment by ekeeke31@gmail.com on 7 Sep 2012 at 2:21

GoogleCodeExporter commented 8 years ago

Original comment by ekeeke31@gmail.com on 7 Sep 2012 at 2:29

GoogleCodeExporter commented 8 years ago
Seems like I fixed it. The key was not only to improve synchronization between 
emulated sound chips using a common clock based resampling for FM and PSG chips 
(to get an unique number of samples per frame, accurately tied to input 
framerate and output samplerate) but also to adjust the output framerate value 
(a little lesser than 48000hz to take resampler approximations in account).

I now can sync frame emulation with BOTH video & audio hardware interrupts and 
it does not seem to miss or repeat any single frame anymore, neither video 
frame (tested with Sonic 2 interlaced mode to verify field rendering is 
perfectly synchronized to Video Interrupt) or audio frame (tested with Lunar 2 
intro and Virtua Racing to verify audio buffer under-run or overrun issues does 
not happen anymore).

Original comment by ekeeke31@gmail.com on 13 Sep 2012 at 11:34

GoogleCodeExporter commented 8 years ago
Issue 260 has been merged into this issue.

Original comment by ekeeke31@gmail.com on 13 Sep 2012 at 11:49

GoogleCodeExporter commented 8 years ago
Great news!  Thanks for all of your hard work!

Sorry for an unrelated question, but could someone explain how to install these 
sub-versions?  I do not see them in the downloads section.  

Thanks!

Original comment by blacksto...@gmail.com on 14 Sep 2012 at 2:21

GoogleCodeExporter commented 8 years ago
You will need to compile them yourself from SVN or find someone to compile it 
for you.
As for recent updates, they were not committed to SVN and therefore not 
available yet.

Original comment by ekeeke31@gmail.com on 14 Sep 2012 at 7:02

GoogleCodeExporter commented 8 years ago
If you could post a binary with your current fixes I would be glad to test it 
on my Wii and see if I find any issues.

Original comment by swsparkl...@gmail.com on 15 Sep 2012 at 8:35

GoogleCodeExporter commented 8 years ago
Here is a testing version based on my current work version (more or less).

Note that this is still beta so other bugs might exist (please report them 
here).
It also has preliminary cue+bin with audio track support that you could 
eventually test more thoroughly than me (it was implemented a few days ago on 
my spare time and only quickly tested with two or three games I had in this 
format). The only current restriction is that .bin and .cue files must be named 
the same.

Original comment by ekeeke31@gmail.com on 18 Sep 2012 at 8:06

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks!  I will give it a shot.

Original comment by blacksto...@gmail.com on 18 Sep 2012 at 8:50

GoogleCodeExporter commented 8 years ago
Great work. It's looking really good so far. I just did some quick testing with 
Sonic 2 and Sonic 3 in the test version, and I could not hear any audio 
crackling anywhere. Not even in special stages. I will test Sonic CD later. Are 
there any other specific "possibly problematic" games that I should test?

Original comment by swsparkl...@gmail.com on 18 Sep 2012 at 10:10

GoogleCodeExporter commented 8 years ago
Audio is perfect for Lunar 1 (J).  Still getting just a little crunch in the 
intro music for Lunar 2 (J).

Original comment by blacksto...@gmail.com on 19 Sep 2012 at 1:38

GoogleCodeExporter commented 8 years ago
Thank you Ekeeke!
I can re-confirm that Lunar II's opening audio is still a little crackly. I'm 
running off a USB HDD with 1.0 BIOS. Audio track support seems to work good 
with games such as Final Fight CD but is almost guaranteed to mess up with long 
cutscenes that use audio tracks, such as the opening to Snatcher and 
Popfulmail.   

I haven't tested that many games with this build yet so I may post again later 
with a more broader examination . Hope this report helps and thanks again! 

Original comment by TheRealB...@gmail.com on 19 Sep 2012 at 1:49

GoogleCodeExporter commented 8 years ago
I just located an image of Lunar 2 (NTSC-J) and I can hear lots of audio 
crackling too. First in the opening (before the "new game" screen shows up), 
and then when Heero and the flying thing are digging in the wall and then 
falling down and it continues through the whole scene. I should probably note 
though that my image might not be ideal. It's iso+cue+wav. I will try with a 
bin+cue image if I find one. I'm testing this on a microSD card.

Original comment by swsparkl...@gmail.com on 19 Sep 2012 at 2:46

GoogleCodeExporter commented 8 years ago
That's unfortunate because i don't have any cracklings in lunar 2 intro anymore 
myself.
And snatcher is the one i tested for audio track support , worked perfect 
during the whole intro :-/
Does it happen for anyone here ?

Please post recordings with reference to when crackling occurs so that i can 
check out and compare with what i got because i'm afraid at this point i'm out 
of ideas. Testing more games won't really help as it won't provide any usable 
proof or hint. Would be more useful if you could confirm same issues does not 
happen with VSYNC forced OFF or try in various video modes 
(original/interlaced, 50/60hz)

Also, try from SD or another USB drive and see if it is the same, maybe it 
struggles because accessing the device is too slow. In that case there is 
nothing i can do on my side.

Original comment by ekeeke31@gmail.com on 19 Sep 2012 at 2:48

GoogleCodeExporter commented 8 years ago
Image type makes no difference, what is important is game region (PAL/NTSC), 
system region (AUTO or forced), video mode (ORIGINAL/INTERLACED, 50/60HZ) and 
syncing method (VSYNC AUTO or OFF).

Original comment by ekeeke31@gmail.com on 19 Sep 2012 at 2:55

GoogleCodeExporter commented 8 years ago
Here is a sample of the Lunar 2 intro music.  There is a faint rhythmic 
cracking sound in the background.

This occurs regardless of the game region, system region, video mode, and 
syncing method.  This iso is on an SDHC card.

Original comment by blacksto...@gmail.com on 19 Sep 2012 at 3:09

Attachments:

GoogleCodeExporter commented 8 years ago
I did the same testing with my PSP's memory stick connected to the Wii through 
USB and I got much better results. I suggest adding a note about reading speed 
on the front page and/or the FAQ since it seems that as long as the storage 
medium or device is fast enough there is no audio crackling (at least not in 
this game so far).

A little off-topic, but do you know any good HDDs that would be reliable and 
fast enough for this? I've been looking around on wikis and reading people's 
experiences but it seems to be kind of hit-and-miss so far. The memory stick 
works great, but it only has 32 GB of space.

Anyway, awesome work. I will test some more. I still haven't tested Snatcher.

Original comment by swsparkl...@gmail.com on 19 Sep 2012 at 3:28

GoogleCodeExporter commented 8 years ago
I tested Lunar II again on my 4gb sandisk class 4 SD card and the audio didn't 
appear to crackle. I'm a little confused on why this is because my external HDD 
has never once had speed issues with anything else Wii related. This includes 
running Wii and GC games from it along with Turbografx-CD games with 
Wii-mednafen. 

I understand that the CD is being read heavily during this section of the game 
(which is indicated by the Wii's LED) which makes me think it's an issue with 
the access rate on my HDD being slower than a flash SD card (which is normal). 

However I still don't quite get why my HDD isn't capable of streaming something 
that was originally intended for an old CD-ROM drive? As stated its been able 
to do much more demanding things without issues.

Original comment by TheRealB...@gmail.com on 19 Sep 2012 at 4:11

GoogleCodeExporter commented 8 years ago
You cannot just simply compare CD drive 1x speed and USB speed when emulation 
is involved. 
I am emulating CD  access at 1/75 s like a real 1X CD drive but during this 
time, I need to read a 2048 (DATA) or 2352 (CDDA) bytes sector from the device 
but also emulate for the same relative duration the whole Genesis hardware, SCD 
hardware, etc... while the only thing your old CD drive was doing was to 
transfer data to other hardware running in parrallel.

I am using a western digital 250gb passport hdd and have no speed issues. Like 
you figured, these parts are constantly streaming data from the device, which 
might not be the case in other programs. Or it could be that sega cd emulation 
is more taxing than these programs and gives less remaining time for file 
reading. Image file access could maybe be buffered in the emulator but i think 
it's already done by libfat (read ahead cache) and that it won't neccessarily 
improve anything as it would still need to access the device at enough speed. 
Also, even if it seems trivial, you might want to verify HBC or whatever you 
use to load the emulator is using ios58. The emulator does not try to reload it 
on startup like others might do and HDD cannot use USB2 mode if ios58 is not 
loaded.

Original comment by ekeeke31@gmail.com on 19 Sep 2012 at 5:28

GoogleCodeExporter commented 8 years ago
@ekeeke31

I've tested 2 games thus far, Sonic CD and Lunar The Silver Star, and when I 
load a Save State of these CD games, the sound goes crazy. Other than that, 
everything seems fine. (using Bin+Cue format)

Original comment by nintygaming on 19 Sep 2012 at 5:53

GoogleCodeExporter commented 8 years ago
hmm, i indeed forgot to seek to the saved audio track position when loading 
state. 
thanks for the report

Original comment by ekeeke31@gmail.com on 19 Sep 2012 at 7:02

GoogleCodeExporter commented 8 years ago
I haven't located a copy of Snatcher yet, but I've seen a GUI bug in Genesis 
Plus GX. If you open the audio settings menu and try to change what kind of 
filtering to use, the entire filter option will often disappear and can't be 
accessed until you reopen the audio settings menu.

Original comment by swsparkl...@gmail.com on 20 Sep 2012 at 2:14

GoogleCodeExporter commented 8 years ago
Thanks for telling us about your HDD. It seems that a lot of newer passport 
HDDs from Western Digital have non-removable software though, so I'm unsure how 
safe it would be for me to go with that.

Original comment by swsparkl...@gmail.com on 20 Sep 2012 at 2:17

GoogleCodeExporter commented 8 years ago
I just tried this on Sonic CD, Snatcher and Lunar 1 and I just get a loud 
static throughout.  I can still hear the sound effects.

Original comment by daj...@gmail.com on 25 Sep 2012 at 7:50

GoogleCodeExporter commented 8 years ago
You need a valid cue file with your bin file, with the exact same name and in 
the same directory or it won't work. For example, "Sonic CD.bin" needs a valid 
"Sonic CD.cue" file. If the cue file is invalid or is not found, the emulator 
will not be able to find audio tracks location in the bin file and the uploaded 
version will indeed output random data instead of music. I think the same 
happen if you load a simple iso file,  i know I fixed this but am not sure if 
it was before uploading this beta or after.

So, bin/cue only if you wanna test audio track support. If it still doest not 
work, upload the cue so i could have a look ...

Original comment by ekeeke31@gmail.com on 25 Sep 2012 at 8:05

GoogleCodeExporter commented 8 years ago
The bin/cue files are named the same.

Original comment by daj...@gmail.com on 25 Sep 2012 at 8:29

GoogleCodeExporter commented 8 years ago
Here is the .cue

Original comment by daj...@gmail.com on 25 Sep 2012 at 8:30

Attachments:

GoogleCodeExporter commented 8 years ago

FILE "Lunar The Silver Star.bin" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00

Not sure who made this crap but it only shows the first track and is obviously 
missing audio tracks indexes, making it completely useless.
Sorry but it´s not a valid cue file, check redump.org for valid ones

Original comment by ekeeke31@gmail.com on 25 Sep 2012 at 8:40

GoogleCodeExporter commented 8 years ago
@daj: If all of your images are like this you should probably find a better 
source to download from, or find a better dumping method (if you're making 
images from physical CDs).

Original comment by swsparkl...@gmail.com on 26 Sep 2012 at 7:56

GoogleCodeExporter commented 8 years ago
Speaking of redump.org: They list multiple bin files in many of their cue 
sheets. Is this supported in Genesis Plus GX? Sorry for going off-topic again.

Original comment by swsparkl...@gmail.com on 26 Sep 2012 at 9:24

GoogleCodeExporter commented 8 years ago
I have looked into it and they are indeed listing audio tracks as separated BIN 
files. Not sure why they did that but it's just RAW audio data extracted from 
the initial RAW bin image file. I guess there is as many dump format as there 
are dumping groups and each one feels like reinventing the wheel everytime ;-)
Anyway, this should end up supported since it's valid cue file format but these 
cue files must obvioudly be used only with compatible dumps,it won't work for 
example to replace bad cue files like previous user had. It shouldn't be hard 
to find valid cue file elsewhere though.

Original comment by ekeeke31@gmail.com on 27 Sep 2012 at 6:27

GoogleCodeExporter commented 8 years ago
Awesome! I've tried leaving the Rolling Thunder 2 sound test for 40 minutes 
with the same settings I've been using for my previous tests, and there seem to 
be no sound issues anymore, thanks a lot for your hard work. :)

Now, regarding CD audio:

-Most of the times I'm getting odd sound issues in the Earthworm Jim SE (USA 
BIOS 1.10) title screen (and sometimes in some of the company logos).
-Not sure about this, but at least in EWJ SE it seems that the CD audio volume 
might be a bit too loud, or the rest of the audio is too low?

-Sometimes the game and sound will stop for a very brief time (happened to me 
during the "Down the tubes" demo in EWJ SE).
-While playing Final Fight (USA BIOS 1.10), there was this time in the first 
level where, for a sligthly longer time than the previous issue, the game and 
sound seemed to freeze (with sound still playing) while the hard drive was 
reading something (probably the hard drive's fault, though).
I shall look more into these two issues and report more specific info .

-Probably because of the CD unit's seek time not being emulated, the audio 
tracks seem to start playing too early, so the title screen animation in Sonic 
CD (Japan BIOS 1.00) is out of sync (the inial "SSSSSH-KAH" sound should finish 
right before the white flash, according to actual hardware running an original 
game). This lack of delay could be considered as an improvement when looping 
tracks in some games (less time without background music), so I'd leave it as a 
"CD seek time: Original/Fast" option in any case.

-There's some occasional sound crackling in the Snatcher (USA BIOS 1.10) intro, 
where the voice actor names appear.
-Also, probably due to one of the previous two issues, the final segment of 
Snatcher's intro (with Jamie and Gillian talking to each other) is slightly out 
of sync, with the voices playing a split second before they should.

I'll be posting more details as I run further tests.

By the way, perhaps this issue should be renamed to a more general "Audio 
problems", since it's now covering the Mega-CD stuff?

Original comment by iceknigh...@gmail.com on 29 Sep 2012 at 11:40

GoogleCodeExporter commented 8 years ago
Just tried Wonderdog and noticed that the CD sound volume doesn't change when 
it should fade out at the end of a level.

Original comment by iceknigh...@gmail.com on 30 Sep 2012 at 4:32