About the phase cancel out here
is another example for you. That one puzzled me a bit until I used the channel masking capability of sc68. With sc68 the effect is even worst as the simulation is cycle less both channels are exactly in sync. As sc68 is deterministic the chip state is always the same when the music starts contrary to a real machine. You bore
won't always sound the same on a real ST (according to 505) just as the sndh I have attached above. The cycle less thing is the reason the period reset does not work with sc68 at the moment as it only process the last value for each register in simulated player pass. That can very easily be fixed.
I don't hear a difference with Hatari's not yet released new sound, but I guess I would need to run the music several times before the randomness appears.
Have you considered writing a small sndh file as the one you wrote for the sid effet above, but with 2 voices trying to cancel each other ? This could be useful to compare real STF and emulators, without having to run a complete music file.
Eclipse problem appears at 2'30". It works properly with Hatari.
Hatari 2.0 will immediately starts a new phase when writing a new period value ; this is not accurate, but it prooved to give good results in fact with SID voices
I had the same feeling that the downward model was wrong despite the documentation. I'm glad you did the test. It's quiet some time I wanted to do that too. But I did not have the setup to do it properly. The ``no caching'' was quiet easy to determine by just starting a low frequency sound and change it to a high frequency soon after.
Back in the 90's I had a real oscilloscope that was handy. That's how I developed my first sync-buzz. Not the timer one. It was synced on the video so that the musician could perfectly control the phase between the tone and the envelop. This is when I figured out the way to reset the phase with a 0-period tone but unfortunately it was always a problem that you could not determine the pulse state (low/high).
Just to be clear when you say ``when it reach'' you mean a higher or equal test, right ? Because an equality test would cause a problem when the counter is already higher to the goal (a la SID LFSR bug). The fact that a period of 0 and 1 is equivalent suggest the test is done after the counter is incremented, do you agree ?
Yes, any value >= will trigger the phase change. Having per 0 == 1 also suggests counter is incremented first, then tested after, but that's harder to confirm without a complete chip decapping (as it was done by Ijor for the MMU and the Shifter)
As an example, consider period is 500 and you manage to change period when current counter is 200 (counting up) :
- if you write a new per 50 for example, phase will alternate and restart from 0 with a new max = 50
- if you write a new per 1000 for example, current phase will be extended, it won't alternate until you reach the new max = 1000
Another unrelated thing. I have noticed Hatari used a weird 4-bit to 5-bit value mapping when converting direct 4-bit volume value to 5-bit DAC input. How did you come up with this table ? sc68 uses N*2+1 which mean the sound is never exactly quiet. I wish I still had an oscilloscope.
Do you mean the table "YmVolume4to5" ? In fact it's a direct interpretation of the YM2149 doc, figure 1, page 8, "D-A convertor". Left scale is 4 bit value, right scale is 5 bit value (used by envelope). I just mapped each value on the left to its equivalent value on the right and from there all internal volume operations are made on 5 bits. But on a real ST, it's very hard to hear a difference between volume 0 and 1. Maybe there's one when measuring directly at the YM's pin, but once the signal goes through the filters and the monitor/tv's speaker, it sounds like 0.
I have been snooping around Hatari's work. I've seen a lot of interesting thing. I still use the BLEP synthesis as the main engine for sc68. I have in project to include it in the pulse engine (my legacy engine) as a filter in the future. I might add float support someday too. ARM's days are over. I also use a ``new'' volume table since 2009. Not sure if you noticed that. It's an hybrid between the good old recorded table and the interpolated one. I've sampled all the extremum on a real ST (the faces of the cube). Then I've used the normal formula to interpolate in between.
I might use some inspiration from Hatari code the day I decide to update my terrible STE emulation.
I think Hatari uses a more recent table made by Paulo/LJKB that he posted on atari-forum when writing his hextracker, at this time his table sounded better when playing digisound under Hatari, but it's hard to judge which table is better. As for filtering, trying to model an analog signal can be complicated, especially when the 3 voices are wired together and can give some feedback effect on each other depending on their period.
The BLEP synthesis articles were really interesting, too bad Antti Lankila stopped working on this. It's a really nice approach to replacing the standard ending filtering stage by including it directly in the tone generator.
That's the difficulty to find a correct filter ; back in the days, we were used to some bad quality monitor's speakers, or connecting the ST directly to a better HIFI system, so 2 people having STs might disagree on the results produced by emulators, depending on how much the sound is "soften" by filtering or not.
Back in the '90s, I had a modified STF on which I added a "stereo" output (from an old french ST Magazine article), the sound was "sharper" which IMO gave a better rendering for chip tunes, but for digisound the lack of filtering gave more "noisy" result, so it was not always better.