maEqualizer.c has a bug

  • sartorius

    i think maEqualizer.c has a typo/bug in the slidertodb array:..., -10.5, -10,0, -9.5,...

    and a question :) i want to port your EQ to Psycle project, can i do it?

    • sartorius

      if(g_eqi == 3) g_eqi = 0;
      else if(g_eqj == 3) g_eqj = 0;
      else g_eqk = 0;

      i think g_eqk will be equal 2 just 1 time...

      • Thanks for reporting this.

        There is an error in function int iir(gpointer *d, magint length), this line should not be there:
        g_eqi = 0; g_eqj = 2; g_eqk = 1;

        (i.e. in MoreAmp release 0.1.16, delete line 332 of maEqualizer.c).

        This change will be in the next release (0.1.17).

        These global values are initialized in the declaration at line 300:
        magint g_eqi = 0, g_eqj = 2, g_eqk = 1;

        The original eq_xmms code had static local declarations for these i, j, k variables. I forget why I changed it, possibly because of a problem with a compiler or a platform. That original declaration is still there but commented out (line 326).

        Using the original local static declarations is probably better if it works for you.

        The g_eqi, g_eqj, g_eqk variables sequence like this:

        index=0: g_eqi=0 g_eqj=2 g_eqk=1
        index=1: g_eqi=1 g_eqj=0 g_eqk=2
        index=2: g_eqi=2 g_eqj=1 g_eqk=0

        index=3: g_eqi=0 g_eqj=2 g_eqk=1
        index=4: g_eqi=1 g_eqj=0 g_eqk=2
        index=5: g_eqi=2 g_eqj=1 g_eqk=0


        In MoreAmp, the "length" parameter (pcm block size) passed to function iir is 27648, so "halflength" in "for(index = 0; index < halflength; index+=2)" is a multiple of 2 and 3 and the error causes no problems.


    • Good eyes! (or ears). Thanks!

      I suppose yours is a legal, not technical, question, in which case, nice of you to ask.

      Moreamp, and parts thereof, are GPL.

      The equalizer is copied from eq-xmms-0.5, also GPL, by Felipe Rivera.

      See the AUTHORS file from eq-xmms-0.5.tar.gz for other credits

      There is a more recent eq-xmms-0.6, but I think the dsp part hasn't changed from 0.5.

      Be aware that this implementation can use a lot of cpu time when the 31-bands and 'extra' (two filters cascaded instead of only one) settings are on.

      eq-xmms has an unfinished fixed-point math build option...


    • sartorius

      ok, thanks

      next question :)

      f.ex. i don't want to eq band1000Hz

      dboffset = 0; DBfromScaleGain(32) = 0.0; --> gain[band1000Hz] = 0.0 ?
      NO, it doesn't!
      'coz factor =pow(10,0)=1!
      then gain[band][0] = gain[band][1] = -0.2f + ((float)factor / 5.125903437963185f) != 0

      what can you say?

      • Thanks for checking all this.

        This time, though, I couldn't find a problem.

        For a band to not be boosted or cut by equalizing, its slider needs to be set at about +12 dB, not 0 dB (with offset dB = 0).

        0 dB is just an arbitrary reference line about which to flip values with the Invert function.

        Try this : set Offset dB to 0 and all sliders at +12 dB and turn the eq off and on and you won't hear the volume difference you get with all sliders set at 0 dB (mid).

        The values in gain[][] range from -0.2 to 1.0.

        Maybe the name "gain" for these values creates confusion.

        A slider i set at 0 dB gives factor = 1 and gain[][i] ~= -0.005, close to zero, but that does not mean that 0.000 would be more accurate.

        A slider i set at 12 dB gives factor = 3.98 and gain[][i] ~= 0.576.