Menu

#1696 Adjustments for the reSID 1.0 new filter

v3.x
open-need-info
gpz
None
ReSID (new 8580 filters)
2023-06-01
2022-02-06
bozz64
No

I did some measures with reSID 1.0, in particular the new filter in filter8580new.cc.
I found out that the filter model for 6581 needs one adjustment regarding the DC level to boost the digi output a bit.
I've measured this with real 6581 SID chips and it was clear that real 6581 SIDs have a bit louder digi playback in proportion with the voice output.
DC level value 5.0 needs to be changed to value 5.35.

This can be tested by e.g. songs of Chris Hülsbeck that play voices and digis together.

I also did measurements for the 8580 filter. There the overall volume is too low. Especially when you compare it with the 6581 output.
Just play a song that doesn't use any filter, e.g.:

/MUSICIANS/H/Hubbard_Rob/Commando.sid

and play it as 6581 and then as 8580.

I've measured output levels of the same song on a real 6581 and 8580 and how it is configured now is wrong.

To fix this, the first value of the 8580 filter needs to change from 0.2 to 0.5. This will increase the volume a lot and some heavy filtered tunes might clip because of this.
Therefore transistor parameter value 9.09 needs to be increased to value 13.0.

The new values can be tested with tunes like:

/MUSICIANS/L/Linus/64_Forever.sid
/MUSICIANS/J/Jammer/Yet_Bigger_Beat_2SID.sid

The current DC level of the 8580 is set to 4.80. This is needed to make digi playback without using the 3 voices on a 8580 audible but very soft.
However, the current value is problematic for the following tune:

/MUSICIANS/P/Psych858o/90_Seconds.sid

Notice that you will hear a tone at the beginning which shouldn't be there. On a real 8580 the tone is not there.

The problem can be fixed to change value 4.80 to 4.84. This value still gives the right low volume output of digi playback via $D418.
I've tested this on sound cards at 44.1KHz and on 48KHz and the tone is not audible anymore with the new value 4.84.

The last change I would suggest is to change the second transistor parameter value 0.80. This needs to change to value 1.0 to make the filter sound the same as a real 8580.
I've tested this with tunes s.a.:
/MUSICIANS/P/Psych858o/90_Seconds.sid at 0:07 for the bass sound.

For the complete change in file filter8580new.cc:

static model_filter_init_t model_filter_init[2] = {
  {
    opamp_voltage_6581,
    sizeof(opamp_voltage_6581)/sizeof(*opamp_voltage_6581),
    // The dynamic analog range of one voice is approximately 1.5V,
    1.5,
    // riding at a DC level of approximately 5.0V.
    5.35,
    // Capacitor value.
    470e-12,
    // Transistor parameters.
    12.18,
    1.31,
    26.0e-3,
    1.0,
    20e-6,
    9.0/1.0,
    1.0/115,
    // DAC parameters.
    6.65,
    2.63,
    2.20,
    false
  },
  {
    opamp_voltage_8580,
    sizeof(opamp_voltage_8580)/sizeof(*opamp_voltage_8580),
    0.5,
    // The 4.75V voltage for the virtual ground is generated by a PolySi resistor divider
    4.84,
    // Capacitor value.
    22e-9,
    // Transistor parameters.
    13.0,
    1.0,
    26.0e-3,
    1.0,   // Unused, leave at 1
    100e-6,
    // FIXME: 6581 only
    0,
    0,
    0,
    0,
    2.00,
    true
  }

Discussion

1 2 > >> (Page 1 of 2)
  • gpz

    gpz - 2022-02-06

    To me this sounds a lot like "tweaking numbers until it sounds like i think it should be" - i will ask Leandro to take a look.

    The volume difference between 8250 and 6851 was deliberate iirc, to compensate for that i'd rather make 6581 a bit more silent than tweaking parameters that might have other influences on the sound (but thats just me, i know nothing about resid code)

     
  • Leandro Nini

    Leandro Nini - 2022-02-07

    Interesting, I'll give this a try.
    Anyway, from a theoretical point of view, the DC is given on the 6581 by the Vcc (5V) and on the 8580 by a voltage divider providing circa 4.75 Volts, not sure how far these values can actually drift. And the Vdd for the 8580 cannot surely reach 13 Volts, being powered at 9V.

     

    Last edit: Leandro Nini 2022-02-07
  • bozz64

    bozz64 - 2022-02-07

    The lowest value for the Vdd for the 8580 with these settings is 12.25 when you have 0.5 as first value. With this you don't get clipping for tune:

    /MUSICIANS/L/Linus/64_Forever.sid

    You will also hear a bit distortion at the beginning of the tune which is also noticeable on a real 8580. If this is preferred, then use value 12.25 or 12.3 to be on the safe side.

    About the suggestion of Groepaz to make the 6581 more silent is wrong to me since with the previous filter implementation by Dag Lem, it has the 8580 louder and more close to the level of the 6581. So the changes in filter8580new.cc made the 8580 volume softer. Also this is not the only issue that I mentioned that the new settings will improve.

    That the value of 12.25 or 13 is not around value 9 that represents 9V is maybe due to the interpretation of the value. I can't tell unfortunately but I hope Leandro can find out ;-)

     
  • Querino

    Querino - 2022-02-11

    why not compiling a special and let people do some tests?

     
  • bozz64

    bozz64 - 2022-02-13

    I tested a lot more and found out that the suggested DC value (5.35) for the 6581 filter is problematic for tune:

    /MUSICIANS/T/Tel_Jeroen/2400_AD.sid

    With the current DC value of 5.0, the digi output is too soft compared to the voice output so then it needs to be fixed via another way or other params needs to be adjusted to let it work for DC value 5.35.

     
    • Leandro Nini

      Leandro Nini - 2022-03-03

      With a bit of math 5.075 seems a more realistic value:

      12.18 : 12 = 5.075 : 5

      The digis are also affected by the waveform offset (see set_chip_model in voice.cc)

       
  • gpz

    gpz - 2022-02-13

    why not compiling a special and let people do some tests?

    I am very reluctant with tweaking values based on tests done by random people with their favourite tunes. This will only produce chaos.

     
  • Leandro Nini

    Leandro Nini - 2022-03-04

    Adjusted the gain tables plus a couple of minor tweaks. Not a big difference but may be used as a base for further tests.

     
  • gpz

    gpz - 2022-03-04

    applied patch in r41882 - please test

     
    • bozz64

      bozz64 - 2022-03-06

      I did some quick tests yesterday. Like Leandro said, it's not a big difference but a base. I want to test properly and this takes some time.

       
  • gpz

    gpz - 2022-03-04
    • status: open --> open-need-info
    • assigned_to: gpz
     
  • gpz

    gpz - 2022-03-13

    Unfortunately this patch breaks 6581 (!) - try the attached file, before the patch (r41881) the SID voices are fine, after the patch they are almost non audible. (from https://csdb.dk/release/?id=552 )

    Another observation that hints at something fishy with this patch - i can run the windows SDL2 version of r41881 using WINE on linux fine. r41882 crashes!

    @Leandro Nini please have a look

     
    • Leandro Nini

      Leandro Nini - 2022-03-13

      Uh, right, I've messed up with the opamp array leaving accesses after deallocation.
      Fixed and cleaned up the initialization, patch attached.

       
  • gpz

    gpz - 2022-03-13

    thank you, applied in r41940

     
  • bozz64

    bozz64 - 2022-03-15

    I've tested with the latest patch from 2 days ago and there is something wrong with playing samples on a 8580 when no voices are played. I've attached the file 4753_Digi-Mixes.sid which I modified for 8580. The samples play distorted which is not the case on a real 8580. This problem didn't exist before the changes made for this bug report.

     
    • bozz64

      bozz64 - 2022-03-15

      I just found out that the problem with the digi playback is caused by patch:

      https://sourceforge.net/p/vice-emu/bugs/1698/#45e8

       

      Last edit: bozz64 2022-03-15
  • bozz64

    bozz64 - 2022-03-19

    I did a lot of measurements today and compared the output of the old code with the new code. I applied the patch together with the latest patch of bug report:

    https://sourceforge.net/p/vice-emu/bugs/1698/#015b

    I compared the output with a good quality monitor headphone and played the tunes loud. I compare the output by switching from reSID to a real SID on the fly while playing SID tunes.

    In order to get the output level correct for the new patch I had to change the voice_voltage_range to 0.38. Therefore I had to increase the Vdd to 10.0 to avoid clipping of some songs. It is still not the wanted 9 volt though.

    I also think the voice_DC_voltage value of 4.84 is better. It will make the output level when only digi's are played the same as on a normal 8580.

    Also the Vth should be changed from 0.8 to 1.0 as indicated in my first post. Just have a close listen to song:

    /MUSICIANS/P/Psych858o/90_Seconds.sid

    and focus on the bass and compare with a real 8580.

    There is a new side effect on the output of the 6581 and I'm not sure if it is related to this patch or from the other bug report. I suspect the other patch. When you play e.g. the 90_Seconds.sid tune now on reSID 6581, you will hear a high tone at the beginning. This was not the case before the patches and it is also not the case on a real 6581.

    Here are the changes applied to the model_filter_init for 8580:

      {
        opamp_voltage_8580,
        sizeof(opamp_voltage_8580)/sizeof(*opamp_voltage_8580),
        // FIXME: Measure for the 8580.
        0.38,   // was 0.25
        // The 4.75V voltage for the virtual ground is generated by a PolySi resistor divider
        4.84,   // was 4.80
        // Capacitor value.
        22e-9,
        // Transistor parameters.
        10.0,   // was 9.09
        1.0,    // was 0.80
        26.0e-3,
        1.0,   // Unused, leave at 1
        100e-6,
        // FIXME: 6581 only
        0,
        0,
        0,
        0,
        2.00,
        true
      }
    

    When you compare those changes to the changes I made in the first post, there is some difference in the output. With the new patch, it seems the output has a little less bass now. If you compare the new patch with a real 8580, then a real 8580 has a bit more bass and sound a bit richer.

    The following song is a good song to test with:

    /MUSICIANS/P/Psych858o/90_Seconds.sid

     
    • Leandro Nini

      Leandro Nini - 2022-03-24

      Thanks for the interesting data. As groepaz says it is just one chip and results may vary but it is a good starting point for further analysis.
      By the way, I'm starting to wonder how much the power brick quality affects the sound. Can we be sure that the actual voltages are close to the nominal ones?

       
      • bozz64

        bozz64 - 2022-03-25

        When I tested the output I made sure the volume level of the reSID 6581 and my real 6581 SID are equal. I played a song without filters and changed the faders of my mixer until the output level of both are the same. I switched to real and reSID all the time to be sure the output level is the same.
        I then switched to reSID 8580 and also changed to a real 8580 on the same hardware device so you can clearly compare the output levels.
        Please do the same and notice that the suggested parameters fixes the output level.

        Then compare the output from the old code (with the suggested parameters) and the output of the patch (with the suggested parameters).

        I tested a lot of tunes and compared the output closely. I only noticed the bass difference after the patch and the high frequency is probably from the other patch and that same high frequency was also solved by a change I did in the voltage (4.80 to 4.84). You need to play the suggested tune loud to notice the problem.

        If you come up with something else, I'm happy to test again.

         
  • gpz

    gpz - 2022-03-23

    I have to admit i kindof lost track here (just like in #1698) and i almost feel like reverting back to a much earlier state (before r41881), apparently more broke than was fixed - @Leandro please speak up and suggest how to proceed. Perhaps reverting some things and trying to fix whatever broke in r41881 first, and not fiddle with two different things at the same time is a better strategy.

     
  • bozz64

    bozz64 - 2022-05-14

    I just found out that the voice_DC_voltage suggestion for the 8580 to change to 4.84 is not right. In stead of increasing it, it should just be lowered to 4.74 which also makes more sense. This also fixes the output of tune:

    /MUSICIANS/P/Psych858o/90_Seconds.sid

    where the current value of 4.80 causes weird frequencies at the beginning of the tune.

    I'll also attach a tune that will be in the upcoming HVSC, that is worth to test with for the tweaks I did above since the filter setting of the tune can cause clipping. With the DC voltage of 4.74 and Vdd set to 12.4 or higher, the output isn't clipped anymore.

     

    Last edit: bozz64 2022-05-14
    • bozz64

      bozz64 - 2023-04-23

      I made a mistake here and tested with digi boost on so please ignore the finding about the Umi_64_loader.sid tune. Still an interesting tune to test with.

       
  • Leandro Nini

    Leandro Nini - 2023-04-23

    hmmm, by increasing the voice_DC_voltage and leaving Vdd untouched I can get a louder volume with little or no distortion, but then the digis become too strong :/

    --- a/src/resid/filter8580new.cc
    +++ b/src/resid/filter8580new.cc
    @@ -204,9 +204,9 @@ static model_filter_init_t model_filter_init[2] = {
         opamp_voltage_8580,
         sizeof(opamp_voltage_8580)/sizeof(*opamp_voltage_8580),
         // FIXME: Measure for the 8580.
    -    0.25,
    +    0.35,
         // The 4.75V voltage for the virtual ground is generated by a PolySi resistor divider
    -    4.80, // FIXME
    +    5.10, // FIXME
         // Capacitor value.
         22e-9,
         // Transistor parameters.
    @@ -649,7 +649,7 @@ void Filter::adjust_filter_bias(double dac_bias)
       // Gate voltage is controlled by the switched capacitor voltage divider
       // Ua = Ue * v = 4.75v  1<v<2
       model_filter_init_t& fi = model_filter_init[1];
    -  double Vg = fi.voice_DC_voltage * (dac_bias*6./100. + 1.6);
    +  double Vg = 4.75 * (dac_bias*6./100. + 1.6);
       double Vgt = Vg - fi.Vth;
       double vmin = fi.opamp_voltage[0][0];
    
     
    • bozz64

      bozz64 - 2023-04-23

      Did you test the values provided from the original post, without all the patches you did afterwards? Please do so and compare it with a real 8580.

      For the 8580, I ended up with a opamp_voltage_size of 0.5 and a voice_DC_voltage of 4.838 but these values are only right before patch:

      https://sourceforge.net/p/vice-emu/bugs/1698/#015b

      With this patch I couldn't get it right anymore compared to a real 8580 with the adjustments of the opamp_voltage_size and voice_DC_voltage described above in post from 2022-03-19. It had less bass compared to a real 8580.

       
  • Leandro Nini

    Leandro Nini - 2023-04-30

    Vdd is the supply voltage and it can't be anything other than 9 Volts and the ringing fix has been proved both theoretically and empirically.
    Given that, a DC_voltage of 4.84 indeed seems to produce a better result (you also have to change Vg as in the patch below) but a voltage range greater than 0.3 still causes an annoying distortion in /MUSICIANS/L/Linus/64_Forever.sid

    --- a/src/resid/filter8580new.cc
    +++ b/src/resid/filter8580new.cc
    @@ -204,9 +204,9 @@ static model_filter_init_t model_filter_init[2] = {
         opamp_voltage_8580,
         sizeof(opamp_voltage_8580)/sizeof(*opamp_voltage_8580),
         // FIXME: Measure for the 8580.
    -    0.25,
    +    0.30,
         // The 4.75V voltage for the virtual ground is generated by a PolySi resistor divider
    -    4.80, // FIXME
    +    4.84, // FIXME
         // Capacitor value.
         22e-9,
         // Transistor parameters.
    @@ -649,7 +649,7 @@ void Filter::adjust_filter_bias(double dac_bias)
       // Gate voltage is controlled by the switched capacitor voltage divider
       // Ua = Ue * v = 4.75v  1<v<2
       model_filter_init_t& fi = model_filter_init[1];
    -  double Vg = fi.voice_DC_voltage * (dac_bias*6./100. + 1.6);
    +  double Vg = 4.75 * (dac_bias*6./100. + 1.6);
       double Vgt = Vg - fi.Vth;
       double vmin = fi.opamp_voltage[0][0];
    

    Haven't tried to change Vth yet

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.