Re: [hatari-devel] Improved YM2149 sound

```Hi Nicolas,

I'm going to air my thoughts so that you can analyse my reasonings.

As regards Paulo's tables, they were measured well, making it possible
for me to decide what was causing the non-linearities. I first thought it
may be compression due to transistor gain so I was looking at sigmoid
functions, especially tangent... but Paulo's tables disagreed. So I
thought of a voltage source that could pull up with a given Thevinen
resistance... Paulo's tables agreed. Next came circuit analysis and
experimentation... The rest is history. Paulos's tables give justification
to the math model. The math model allows me to determine the actual
resistances and ac voltages... and allows me to use the derived formulas
in further circuit analysis... The case is cracked wide open and can be
tested against itself. Paulo's tables told me enough to let me see the
rest of the picture... The math model goes beyond the tables now.

What the math model does:

- Paulo may have measured with per=0, but the math model gives a voltage
level for any discarded high (or low) frequency because the residual voltage
level is the dc component of that frequency.

- Modeling of all combinations of discarded high frequencies (Quartet)
and all combinations of non-discarded frequencies (Normal).

- Paulo's tables do not impose limitations on the math model because the
math model now describes Paulo's tables.

The code meets the objective of the math model as mentioned above.
The code does not differentiate between Normal mode and Quartet mode because
it is not necessary to do so... There really is no Quartet mode, just
filtered high frequencies... just like a real ST.

When "normal" (non sample) music is played and any voiceX goes to per=0
(or per is any filtered frequency), the new code treats the voltage exactly
as if it were filtered. This is what we want. Especially when it happens
transiently. The new code does way more than Quartet mode. Simplicity

A table to represent Normal (ac + dc components) and Quartet (dc component)
would have to be dimensioned:

((32 #ac+dc#)+(32 #dc#)) * ((32 #ac+dc#)+(32 #dc#)) * ((32 #ac+dc#)+(32 #dc#))

(32 #ac+dc#) * (32 #ac+dc#) * (32 #ac+dc#)
Note that the current table treats Quartet mode the same as Normal mode by
using the same table-value for both.

I noticed that using the "-1" correction is a good substitute for a large
look-up table. It works good because Paulo's Quartet table is related to
the Normal table. Furthermore, the "-1" correction is already summed into
the table with the other values.

Picking 1 less from the Normal table as a Quartet value is a better
approximation than picking the same value (the current method in Hatari).

Picking 1 less also allows us to use the current table also!

ps.
I'll submit a comment patch tonight (pacific standard time).

Please let me know if my explanations are not clear, or if I'm
overlooking something. I'm now going to ponder the code changes
you mentioned.

Sincerely,
David

```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/