# any way to set AY PSG phase?

Page 3/4
1 | 2 | | 4

there is an easy way to measure it, an envelope triangle wave has different loudness with tone off vs high frequency tone
the 100khz tone makes openmsx sum it to a middle state of less volume
I guess real machines capacitor business does the same

press enter to change

10 sound 11,33 : sound 12,0 : sound 13,8 : sound 1,0 : sound 0,0 : sound 8,16
20 sound 7,&b111001
30 ?"tone off" : a\$ = input\$(1)
40 for i = 0 to 15
50 sound 7,&b111000 : sound 0,i
60 ?"tone on, period ";i : a\$ = input\$(1)
70 next
80 goto 20

but if period = 0 makes something different
it could be that it just forces tone = high like register 7 and doesnt write the flip register bit
what sense would that make
started a feature and then finished it cheap
chips of those days show that functions are a lot cheaper than register state action

I do not see how this is related with testing the behaviour of the psg when period=0...

Now I see also why openmsx toggle the output even if counter is zeroed when period =1.
The fact is that output depends on cycles that is valorised before count is reset.

int cycles = count / period; // <-here count is != 0
count -= period * cycles;    // <-here count is reset to 0
output ^= cycles & 1;        // <-here output takes the value from cycles that is not zero

I tested the real thing, it is all like the emu.
period = 0 is less loud than tone disabled in R7. same for all the others to 15 and at some point the tone gets audible.
that fits the logic
counter = counter + 1
if counter >= comparator then counter = 0 : flip the flip register bit
and no further logic

Quote:

I do not see how this is related with testing the behaviour of the psg when period=0...

the envelope always counts volume 0 to 15, so how come that one can make triangle wave sounds of two different loudnesses.

the flip register bit goes 01010101010
0 makes 0 volts
1 makes volume register voltage

disabling the tone in register 7 makes it 1111111 (always volume register voltage)
so, a triangle sound goes like this 1111222233334444 (the envelope is setting the volume value)
then have a tone of higher frequency and enable it in R7, it goes like this 1010202030304040

and this fast wiggle in the 100khz ballpark, a capacitor turns 2020 to be like 1111.
one has 1111 where the pure triangle would be 2222, the triangle gets less loud.
the test behaves like this model.

well but meanwhile I am no more unhappy about the lack of phase reset
because it doesnt work with virtual channels
and virtual channels with volume priority sheduling makes it a better chip

was the phase reset related to an idea about mp3?
the recent demo of the game with "NES mp3 sound" was so awesome. the MSX has that squeak sound of the special triangle waveform of the NES.
the game could play only one at a time but with volume priority one can easily play multiple.
when you play 3 mp3, 9 virtual channels, the result will be like one sample of a wav playing those 3 mp3 in parallel. volume priority makes the same as the sampling tool.
especialy with game noises one doesnt cry about quality loss, when a squeak gets hit by a kaboom then the ear doesnt complain that meanwhile the squeak lost some spectrum.

hit9918 wrote:

there is an easy way to measure it, an envelope triangle wave has different loudness with tone off vs high frequency tone
the 100khz tone makes openmsx sum it to a middle state of less volume
I guess real machines capacitor business does the same

press enter to change

10 sound 11,33 : sound 12,0 : sound 13,8 : sound 1,0 : sound 0,0 : sound 8,16
20 sound 7,&b111001
30 ?"tone off" : a\$ = input\$(1)
40 for i = 0 to 15
50 sound 7,&b111000 : sound 0,i
60 ?"tone on, period ";i : a\$ = input\$(1)
70 next
80 goto 20

But you are putting the tone off

20 sound 7,&b111001

I see the math behind your test and it is based on the same proposal I did on the square wave.
The point is how the ay8910 works when the period is 0 and the tone is active.

but in the FOR loop I put the tone on again!

the reason I test other periods 0 to 15 is to show that they all make no difference
period = 0/1 has the same dimmed volume as period 2/3/4...
only tone off has the loud triangle.
this tells that period = 0/1 are oscilating like all the others.

I tested PSG period=0 with my oscilloscope, post from a year or maybe two ago should be here somewhere on the forum; iirc period=0 is identical to period=1 (rapid oscillation).

very good, another test.
there is this idea that there is a special logic for the values 0 and 1. instead, the only special is that 0 does same as 1.
when you want to design the chip that the frequency goes like 1/x, then the 0 got to do something inconsistent.
while 1 has no special vs all the others 2,3,4...

now, period = 2, which has halve the khz, may hit the radar of hi fi equippment while period = 1 in the 100khz ballpark looks like "no oscilation".
and it is no oscillation for practical purposes, buuut there is a much obvservable relevant effect, the volume voltage is halved.

Page 3/4
1 | 2 | | 4
My MSX profile