Dramatic bad DAC output quality !

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Oct 04, 2008 3:34 pm


I am not saying that game relied on something chip didn't do. I am saying that games relied on their imperfectness. For example, emulating the *perfect* M68000 wouldn't run Gargoyles or Jim Power.

stay safe,

AamirM
As for 68000, PSG is not responsible of these "imperfections", all rely on the MD board and logic. A better implementation would be to add some 'noise adder' after sound generation ;)

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Sat Oct 04, 2008 4:18 pm

Hi,
Stef wrote: As for 68000, PSG is not responsible of these "imperfections", all rely on the MD board and logic. A better implementation would be to add some 'noise adder' after sound generation Wink
Gah...I didn't say that PSG was responsible for this :) . I was just giving an example of an imperfect chip and how games relied on it. And these imperfections of 68000 are caused due to the 16-bit shared bus architecture of the MD which are external to the 68000. Which brings me to my orginial point which was that emulation of external things which can impact the behaviour of a chip is not inaccurate (which Snake says it is) since some games can rely on it.

stay safe,

AamirM

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Oct 04, 2008 5:30 pm

your perfect emulator has to support bus request and other such signals that MD HW utilizes... longer cycles etc...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Mon Oct 06, 2008 11:39 am

AamirM wrote:For example, emulating the *perfect* M68000 wouldn't run Gargoyles or Jim Power.
In the case of Jim Power "perfect" m68k would do just fine, the game relies on some less documented m68k behavior, not a shared bus issue, as it is with Gargoyles.

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Mon Oct 06, 2008 10:25 pm

AamirM wrote:For example, emulating the *perfect* M68000 wouldn't run Gargoyles or Jim Power.
You are, perhaps, forgetting that it was me who discovered all of this (and more) behaviour in the first place, so I pretty much understand exactly how and why it all happens... And yes, it would.
AamirM wrote:And these imperfections of 68000 are caused due to the 16-bit shared bus architecture of the MD which are external to the 68000.
... it has nothing to do with that.

And also that the guy who wrote that PSG doc did a lot of testing in Kega...

The point I'm making is that the document is not accurate. Remember it's just based on observations, sampling the output. It isn't the PSG that's "imperfect". It happens to all analogue signals - including those from a PC. The volume actually has nothing to do with it. It's the difference between two voltages that make it louder or softer, not the voltage on its own - and that distance remains the same.

When you sample something you will get the same effect. The sample will look different. But it wont be louder.

It's simple. Sample a real system, you will see this effect. Sample an emulator, you'll see this effect. The two will look and sound very similar. Can you not see that already makes it accurate?

If the volume is wrong, then the volume is wrong. It isn't because of this.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Oct 07, 2008 11:02 pm

I think he's referring to something like this (extreme example to make a point): you can hook several hundred feet of bad cable to the audio out of the console and hook it to a crappy amp hooked to even worse speakers. The sound will be truly dreadful. Now an emulator is NOT supposed to emulate the hundreds of feet of bad cable, a crappy amp, and even worse speakers, just the source of the sound. If you want it to sound like the described system, you're on your own. :D

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Wed Oct 08, 2008 3:30 am

Chilly Willy wrote:I think he's referring to something like this (extreme example to make a point): you can hook several hundred feet of bad cable to the audio out of the console and hook it to a crappy amp hooked to even worse speakers. The sound will be truly dreadful. Now an emulator is NOT supposed to emulate the hundreds of feet of bad cable, a crappy amp, and even worse speakers, just the source of the sound. If you want it to sound like the described system, you're on your own. :D
And yet, everyone wants emulation of poor and low-cost TV... :D :lol: :wink:

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Oct 08, 2008 7:36 am

HardWareMan wrote:
Chilly Willy wrote:I think he's referring to something like this (extreme example to make a point): you can hook several hundred feet of bad cable to the audio out of the console and hook it to a crappy amp hooked to even worse speakers. The sound will be truly dreadful. Now an emulator is NOT supposed to emulate the hundreds of feet of bad cable, a crappy amp, and even worse speakers, just the source of the sound. If you want it to sound like the described system, you're on your own. :D
And yet, everyone wants emulation of poor and low-cost TV... :D :lol: :wink:
Yes, but making that an optional filter on the output is the way to handle it.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Wed Oct 08, 2008 4:57 pm

Hi,
Snake wrote: You are, perhaps, forgetting that it was me who discovered all of this (and more) behaviour in the first place
Ahh...I didn't knew.
Snake wrote: ... it has nothing to do with that.
Then I would like to know why Gargoyles doesn't do a TAS writeback.
Snake wrote: It's simple. Sample a real system, you will see this effect. Sample an emulator, you'll see this effect. The two will look and sound very similar.
So why does the DAC output Stef is getting and emulators are giving are so different? Sorry if I am getting you annoyed or anything but I want to know.
Chilly Willy wrote: Yes, but making that an optional filter on the output is the way to handle it.
Hmmm......that gives me an idea :idea: .

stay safe,

AamirM

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Oct 08, 2008 5:43 pm

TAS not happening is because of the I/O controller in MD which does not like the way 68K does the TAS... so the instruction does not get done correctly. Genny3 has the this fixed, TAS works, and few games don't...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Wed Oct 08, 2008 9:46 pm

AamirM wrote:Then I would like to know why Gargoyles doesn't do a TAS writeback.
During this instruction the 68K tries to gain exclusive access to the bus. It can't, so it doesn't do the writeback.
AamirM wrote:So why does the DAC output Stef is getting and emulators are giving are so different?
Well, again - comparing a sample of a real system with direct output of an emulator. Two different things even before you begin to look at the problem.

I'm not sure what the issue is to be honest. Loading Stefs ROM into a sound editor seems to be showing the sample is actually 16 bit. Since the DAC is only 8 bit I'm not sure what Stef is doing here, but in any case, it won't sound the same as the original. I'm also not sure what I'm supposed to be listening for. Looking at the sample is of little use, two samples can look completely different (and usually will) and yet sound the same.

All I can tell you is that I've always found the DAC to be pretty good. (It'd HAVE to be - or the YM2612 itself would sound utterly crappy.) Throw perfectly timed square waves at it and it performs exactly as you'd expect. I've had the Z80 throwing 20+hz samples at it way back in the early 90s and it sounded exactly as expected. The sample rate used here really isn't enough for 'high voices'.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Oct 08, 2008 9:59 pm

I do know having differents waveform can produce similar sound, i do know also my sample from emulator isn't the perfect output. I guess there is some modulation due to the quality of souncard and circuit etc...
Anyway in my case, the sound played on the real hardware really sound different compared to what i got from emulators (all ones of course). There is a sort of "vibrato effect" which distord sound. It is not noticable on common beats sound (what the DAC is used in 90% of time) but it's just horrible on voice type sound. I tried to improve sound rate, actually it change the quality but not necessary in the way we expect ! At 18 Khz the "vibrato effect" was even worse than with 16 Khz.
I also tried to send the sample severals time to DAC (twince time afaik which virtually did 32 Khz) but that didn't helped at all.

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Wed Oct 08, 2008 10:19 pm

Ah. Now I know what to listen for :)

So are the samples 16 bit? Are you just outputting high byte to DAC?

[EDIT] Also, did you try playing same sample with one of the drivers other people here have written? Do you get the same effect? I'm guessing a 'vibrato effect' would have to be caused by the driver. I haven't really looked at what you're doing but i suspect there are many different paths the code can take. maybe some of them are slightly faster than the others.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Thu Oct 09, 2008 4:17 am

Maybe you should get output oscillogram and see how they differ? Just recall that duty cycle from DAC is significantly low (about 1 / 12 of time to complete sample time of all 6 channels), oscillogram I already gave. That may affect very strong.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu Oct 09, 2008 7:31 pm

Snake wrote:Ah. Now I know what to listen for :)

So are the samples 16 bit? Are you just outputting high byte to DAC?

[EDIT] Also, did you try playing same sample with one of the drivers other people here have written? Do you get the same effect? I'm guessing a 'vibrato effect' would have to be caused by the driver. I haven't really looked at what you're doing but i suspect there are many different paths the code can take. maybe some of them are slightly faster than the others.
Initially samples were 16 bits of course but i converted them to 8 bits, not a big deal... i didn't tested others drivers but i don't think it comes from the drivers itself as we meet the same "vibrato" effect on Street Fighter 2 ' game. Voices sounds really terrible in that game and i got a similary result (not that bad as i'm not interrupting Z80).
Of course i do need to test with a sample 68000 copy to see if we get better results, then that doesn't explain what happen. Sound is correct in emulators (as Fusion) do there is something strange on real hardware.

Post Reply