Reading through http://md.squee.co/PSG , we found:
But it's also my understanding that volume writes reload the period (tone) counter from what was written to said registers.
Yet if I implement a volume write as always doing that, the audio distortion is pretty bad.
For now, Cydrak came up with this that seems to work well:
... but is that accurate? I'm thinking that maybe ... the counter isn't reloaded on volume writes?
Also, what about noise channel writes? Does that also raise the output to 1?
Next up, there is this: http://www.smspower.org/Development/SN7 ... ectSN76489
I'm not really entirely sure how to emulate this.
For now, Cydrak has a lowpass filter in place:
But I doubt that's enough to simulate that waveform.
What's the best technique for creating more faithful reproduction of the pictured imperfection in square waves?
Lastly ... all of the documentation refers to the PSG running at 3.58MHz ... but unless I run it at 1/16th that speed, or 223.7KHz, then the pitch is way off and the audio sounds terrible.
Am I doing something wrong, or if not, why don't the docs mention there's a /16 divider for clocking the tone/noise channels?
Many thanks in advance to anyone who can help shed some light onto these remaining mysteries :)
Quote:
Note: Any writes to the Attenuators will reset the waveform to high level, as recently found out by TmEE.
But it's also my understanding that volume writes reload the period (tone) counter from what was written to said registers.
Yet if I implement a volume write as always doing that, the audio distortion is pretty bad.
For now, Cydrak came up with this that seems to work well:
Code:
tone0.volume = data.bits(0,3);
if(tone0.pitch < 2) {
tone0.output = 1;
tone0.counter = tone0.pitch;
}
if(tone0.pitch < 2) {
tone0.output = 1;
tone0.counter = tone0.pitch;
}
... but is that accurate? I'm thinking that maybe ... the counter isn't reloaded on volume writes?
Also, what about noise channel writes? Does that also raise the output to 1?
Next up, there is this: http://www.smspower.org/Development/SN7 ... ectSN76489
I'm not really entirely sure how to emulate this.
For now, Cydrak has a lowpass filter in place:
Code:
lowpassLeft += (left - lowpassLeft) * 20.0 / 256.0;
left = left * 2.0 / 6.0 + lowpassLeft * 3.0 / 4.0;
left = sclamp<16>(left);
//same for right channel ... Master System mode is of course monaural
left = left * 2.0 / 6.0 + lowpassLeft * 3.0 / 4.0;
left = sclamp<16>(left);
//same for right channel ... Master System mode is of course monaural
But I doubt that's enough to simulate that waveform.
What's the best technique for creating more faithful reproduction of the pictured imperfection in square waves?
Lastly ... all of the documentation refers to the PSG running at 3.58MHz ... but unless I run it at 1/16th that speed, or 223.7KHz, then the pitch is way off and the audio sounds terrible.
Am I doing something wrong, or if not, why don't the docs mention there's a /16 divider for clocking the tone/noise channels?
Many thanks in advance to anyone who can help shed some light onto these remaining mysteries :)