Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dc1d143 authored by Antti S. Lankila's avatar Antti S. Lankila
Browse files

Remove weighing filter from loudness equalization

I was estimating loudness based on my own hybrid A+C weighing
filter. This looks like the wrong thing to do, because the
ISO 226:2003 curves are defined for dB(SPL).

Also restoring correction back to my originally derived values,
after this bug made me lower the boosts slightly.
parent e2ba63b6
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -79,8 +79,6 @@ int32_t EffectEqualizer::command(uint32_t cmdCode, uint32_t cmdSize, void* pCmdD
			return 0;
		}

                /* Weigher for estimating bass compensation. */
                mWeigher.setBandPass(2200.0, mSamplingRate, 0.33);
                /* 100 updates per second. */
                mNextUpdateInterval = int32_t(mSamplingRate / 100.);

@@ -196,9 +194,9 @@ int32_t EffectEqualizer::command(uint32_t cmdCode, uint32_t cmdSize, void* pCmdD
 * sound pressure level.
 *
 * The boost can be calculated as linear scaling of the following adjustment:
 *     20 Hz +40 dB (unmodeled)
 *   62.5 Hz +20 dB
 *    250 Hz  +8 dB
 *     20 Hz +45 dB (unmodeled)
 *   62.5 Hz +24 dB
 *    250 Hz +10 dB
 *   1000 Hz   0 dB
 *   4000 Hz  -3 dB
 *  16000 Hz  +6 dB
@@ -209,7 +207,7 @@ int32_t EffectEqualizer::command(uint32_t cmdCode, uint32_t cmdSize, void* pCmdD
 * digital sound level against the audio.
 */
float EffectEqualizer::getAdjustedBand(int32_t band) {
    const float adj[5] = { 20.0, 8.0, 0.0, -3.0, 6.0 };
    const float adj[5] = { 24.0, 10.0, 0.0, -3.0, 6.0 };

    float f = mBand[band];

@@ -275,8 +273,9 @@ int32_t EffectEqualizer::process(audio_buffer_t *in, audio_buffer_t *out)
        int32_t tmpL = read(in, i * 2);
        int32_t tmpR = read(in, i * 2 + 1);

        /* Calculate signal loudness estimate */
        int64_t weight = mWeigher.process(tmpL + tmpR);
        /* Calculate signal loudness estimate.
         * XXX: should we be independent per channel? */
        int64_t weight = tmpL + tmpR;
        mPowerSquared += weight * weight;
     
        /* first "shelve" is just gain */ 
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ class EffectEqualizer : public Effect {
    /* Automatic equalizer */
    float mLoudnessAdjustment;

    Biquad mWeigher;
    float mLoudness;
    int32_t mNextUpdate;
    int32_t mNextUpdateInterval;