Page 3 of 5
Posted: Sat Jun 07, 2008 4:39 pm
by HardWareMan
Nemesis wrote:A note about that "ladder" effect, I've seen a similar distortion when sampling the PSG output from the MD1, even when taken straight from the chip.
From VDP?
Posted: Sun Jun 08, 2008 2:43 am
by Nemesis
Yes. I soldered a pin to the board partway along a track leading directly from the PSG output on the VDP, and sampled from that. So it's not "straight from the chip", but only a few cm further down circuit, and before any other components. Here's what I got when recording from "Jum's Genny PSG Jukebox (PD).bin":
http://nemesis.hacking-cult.org/MegaDri ... ukebox.rar
And here's the output from my emulator for reference:
http://nemesis.hacking-cult.org/MegaDri ... ukebox.rar
As a sidenote, I've just picked up this soundcard:
http://www.emu.com/products/product.asp ... oduct=9872
It uses an AK5394A ADC, and is one of the few soundcards in the world that can actually record at 192KHz without any upsampling or other such voodoo. Once it arrives, I'll be snagging some ultra high sample rate recordings from the PSG and YM2612.
Posted: Sun Jun 08, 2008 4:13 am
by HardWareMan
Look at difference of signal shape. On screenshot compare same sound (begining of first long melody).
The top sound graphic shows to us a true square waveform. And it is normal for PSG (should be a RC-chain at output to eliminate "decaying buzz" at sharply amplitude change). But on bottom sound graphics we see another picture. The sound form not square, as it should be. Square amplitude is decaying. That distortion can be because a to small capacitor for that input resistance at soundcard. Or too high output resistance of PSG. So, IMHO you just do not agreed PSG output and sound card input.
Posted: Sun Jun 08, 2008 4:24 am
by Nemesis
Yeah sorry, that was probably the wrong waveform to upload. The second one is being generated by my emulator, but I'm experimenting with leakage decay as described by Maxim in SN76489.txt. Obviously my decay is far too extreme in that sample. I've got to run some more tests on the hardware in order to measure the actual decay rate, and I'm waiting for my new soundcard to arrive before I do that.
What I was referring to with the distortion from the recorded input was the way the entire waveform regularly shifts up and down. See how the waveform is "arched" in the first sample? That should just be a flat and fairly even +/- distribution from 0.
Posted: Sun Jun 08, 2008 4:41 am
by Nemesis
Here's a "perfect" synthetic output from my emulator with no leakage decay:
http://nemesis.hacking-cult.org/MegaDri ... ukebox.rar
It'll be easier to compare. Won't sound as good though.
Posted: Sun Jun 08, 2008 12:32 pm
by HardWareMan
Nemesis wrote:What I was referring to with the distortion from the recorded input was the way the entire waveform regularly shifts up and down. See how the waveform is "arched" in the first sample? That should just be a flat and fairly even +/- distribution from 0.
You know, that "pops" or as you say "arched" is true waveform. Why? Becouse the PSG output is unipolar, not bipolar. So, it have U from 0 to some high value, that below Ucc. So, this signal is have to distort after walk through capacitor. And this distortion not randomly: every period has equal areas above 0 and below 0. For example:
Nemesis wrote:Here's a "perfect" synthetic output from my emulator with no leakage decay:
Sounds much better, but not like as original hardware. But it is can be repeat in hardware.
Posted: Mon Jun 09, 2008 3:07 am
by Nemesis
Ok, so there is a logical hardware reason for this kind of distortion, it's not just some mysterious interference. In that case, I might have a crack at emulating it, or at least approximating the effect. I can see what you mean by the equal area above and below 0. The behaviour is easy enough to understand when you look at the waveform. It shouldn't be too hard to approximate. I can make it an optional emulation feature, like the leakage decay.
Posted: Mon Jun 09, 2008 3:37 am
by HardWareMan
I say "area" in mathematical mean. And zero point offset depend on width of positive and negative half of period. Some people call it "duty cycle". BTW, that is how works PWM (Pulse Width Modulation) DAC. And even your emulated perfect waveform, when pass through DAC output and pre-amplifier will be distort too (you can see this at oscilloscope, connected to soundcard output).
Posted: Mon Jun 09, 2008 3:16 pm
by Chilly Willy
Actually, if you have enough horsepower on the CPU, the easiest way to simulate a cap on a unipolar output is to just do a transform on the data (say, the DCT), zero the DC term, then do the inverse transform. To be REALLY correct, you should also do a single-pole high-pass filter on the terms with the center frequency set by the actual parts in the Genny.
Posted: Mon Jun 09, 2008 4:27 pm
by TmEE co.(TM)
One thing, in MD2, the PSG signal carries a lot of VDP activity noise (kinda like onboard audio on not so good PC mobos).
Posted: Fri Oct 03, 2008 8:08 pm
by Snake
Sorry, bored, replying to old topics
Nemesis wrote:Ok, so there is a logical hardware reason for this kind of distortion, it's not just some mysterious interference. In that case, I might have a crack at emulating it, or at least approximating the effect. I can see what you mean by the equal area above and below 0. The behaviour is easy enough to understand when you look at the waveform. It shouldn't be too hard to approximate. I can make it an optional emulation feature, like the leakage decay.
You're missing something, here. Attempting to emulate this is in fact inaccurate.
What you are emulating is the digital part of the PSG. The digital part of the PSG is perfect and does not suffer from any of this. It's just something that happens to an analogue signal. So, the digital part of your emulator should also be perfect.
You are comparing the digital part of your emulator with the analogue part of the PSG. They're two different things and are going to look different.
Try connecting the soundcard output to another soundcard input (this won't work with 'what you hear' or whatever else your soundcard has) and then sample it. Now you're looking at an analogue signal. You'll notice that your soundcard is already applying these same effects in it's analogue signal.
Therefore - attempting to emulate it is actually wrong
Posted: Fri Oct 03, 2008 10:46 pm
by Snake
HardWareMan wrote:I believe that engineers has an strong reason when projected YM2612 to do this terrible analog part (against of 6 separate DACs)
A very good one - cost.
DACs were horrendously expensive back then. This is why there is only one, and why it's only really 9 bit pretending to be 16 bit via a multiplier on the output. Don't forget it wasn't until 1992 that PC cards could do 16 bit, for the same reason.
For reference, the Emulator III was the first (if I remember correctly) professional level sampler to even have a single 16 bit DAC. Before that they were either 12 or 8 bit (and still cost several thousand dollars). And just look how much that cost, at the same time that the Yamaha chips were being produced...
http://en.wikipedia.org/wiki/E-mu_Emula ... ulator_III
Posted: Sat Oct 04, 2008 8:12 am
by AamirM
Hi,
Snake wrote:
What you are emulating is the digital part of the PSG. The digital part of the PSG is perfect and does not suffer from any of this. It's just something that happens to an analogue signal. So, the digital part of your emulator should also be perfect.
You are comparing the digital part of your emulator with the analogue part of the PSG. They're two different things and are going to look different.
Try connecting the soundcard output to another soundcard input (this won't work with 'what you hear' or whatever else your soundcard has) and then sample it. Now you're looking at an analogue signal. You'll notice that your soundcard is already applying these same effects in it's analogue signal.
Therefore - attempting to emulate it is actually wrong Smile
Though you are right but some games actually depend on such behaviour to sound correct. For example, the perfect PSG won't sound correct in WWF Wrestlemania arcade game character selection screen. The noise level gets quite high there than what PSG produces. The digital PSG also doesn't produce perfect square waves in the first place as well. Thats why there is band limited synthesis to overcome that.
stay safe,
AamirM
Posted: Sat Oct 04, 2008 1:48 pm
by Snake
No, the PSG produces perfect waves, at a much higher frequency, *that* is why you need the band limit. No game relies on something the real chip doesn't do
Posted: Sat Oct 04, 2008 2:41 pm
by AamirM
Hi,
So you mean WWF shouldn't sound like
this. With perfect output noise levels the noise is more or less inaudible.
Here is a doc also explaining the imperfectness of PSG. I have also gotten other PSG related reports of the levels being incorrect compared to real hardware. Thats why I added PSG volume control to Regen. To make people (and in some cases, myself) happy.
Snake wrote:No game relies on something the real chip doesn't do Wink
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