Thanks.
This brings me to another question.
I have seen that a value of 0 in the period of the envelope creates a glitch sound of maximum amplitude. In the MSX Red Book it is stated that the correct values start at 1 (to avoid division by 0 in the frequency calculation I guess).
The same goes for the Tone and Noise periods... however, a value of 0 does not seem to generate any glitch sound.
Is this a normal, or even intended, behavior?
Tone period 0 and 1 are the same iirc, both creating an inaudibly high tone which is filtered by the low pass filter on the audio output as well, so you can't hear it.
The PSG does no divisions, only increment / decrement and comparison.
Is it possible that some implementations of the PSG cause a glitch whilst others don’t? I mean we have at least GI AY-3-8910, Yamaha YM2149F and Toshiba T7766A discrete models. The YM2149F also made it into the ASCII MSX SYSTEM 1 and 2 LSI (because these are CMOS it’s probably the YM3439 design) and the T7766A into Toshiba’s MSX ENGINE LSI.
No there’s no significant difference between types (other than EG resolution of the Yamaha SSG but that’s quite transparent). Aioneko would need to be a bit more specific about what he means by “glitch sound” and what register settings he uses. It sounds like most likely he just hears the envelope in audio frequencies. I believe for the envelope generator, period 0 is half of period 1 (different from the tone generator).
Aioneko would need to be a bit more specific about what he means by “glitch sound” and what register settings he uses.
If you open my test ROM in OpenMSX and activate Envelope for any channel you will hear a sound even if tone and noise flag are off ([H] to activate and [N] to desactivate). This "ghost" sound follow the Envelope shape.
Perhaps it is a normal behavior but I wanted to be sure it is the case.
The raw data send to the PSG is displayed on the page bottom (only the values of registers #7 and #13 are modified before sending to take into account their specificity).
Changing the Envelope period to 0 and the sound will turn to high level... except that I can no longer reproduce the effect. Maybe it was with another emulator. ^^
As I mentioned disabling the tone and noise generator in the mixer results in a HIGH output signal, which is still affected by the volume and envelope controls. So this is completely normal behaviour, and actually desirable for certain purposes like playing samples or log-saw / log-triangle tones with the envelope generator.
In your test program I recommend to add fine control over the envelope frequency, e.g. with the J and M keys, then you will notice you can play tones with a non-square waveform using only the envelope generator with small periods.
To be precise, the mixer works as follows:
((TONE_GEN | ~TONE_ENABLE) & (NOISE_GEN | ~NOISE_ENABLE)) * ENVELOPE_GEN
So if TONE_ENABLE
is false it forces the output high, and the same for NOISE_ENABLE
. The volume controls and envelope affect the high output, so if both are disabled then there is just a continuously high DC output which can be modulated by the envelope and volume.
p.s. The formula above also tells you something about how tone and noise generation are combined when both are enabled.