Page 2 of 2

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 3:47 am
by billw58
stevethefiddle wrote:The method used in Audacity's Normalize effect is to take an average of above and below the zero line. This is not just looking at the highest and lowest peak levels
Steve:
Here's the relevant lines from Normalize.cpp. This is tricky, but in the end mOffset = (-mSum / mCount) where mSum is the sum of all the samples in the range, and mCount is the count of all the samples in the range. So it appears you are right - it's just the average value of all the samples in the range. mMax and mMin are only used to adjust the gain so that clipping does not occur with an asymmetrical waveform, or after DC offset removal is applied.

-- Bill

Code: Select all

void EffectNormalize::AnalyzeData(float *buffer, sampleCount len)
{
   int i;

   for(i=0; i<len; i++) {
      if (buffer[i] < mMin)
         mMin = buffer[i];
      if (buffer[i] > mMax)
         mMax = buffer[i];
      mSum += (double)buffer[i];
   }

   mCount += len;
}

void EffectNormalize::StartProcessing()
{
   mMult = 1.0;
   mOffset = 0.0;
   
   float ratio = pow(10.0,TrapDouble(-mLevel,
                                     NORMALIZE_DB_MIN,
                                     NORMALIZE_DB_MAX)/20.0);

   if (mDC) {
      mOffset = (float)(-mSum / mCount);
   }

   if (mGain) {
      float extent = fabs(mMax + mOffset);
      if (fabs(mMin + mOffset) > extent)
         extent = fabs(mMin + mOffset);

      if (extent > 0)
         mMult = ratio / extent;
   }
}

void EffectNormalize::ProcessData(float *buffer, sampleCount len)
{
   int i;

   for(i=0; i<len; i++) {
      float adjFrame = (buffer[i] + mOffset) * mMult;
      buffer[i] = adjFrame;
      gFrameSum += fabs(adjFrame);  //lda: validation.
   }
}

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 5:38 am
by kozikowski
So it is the energy in the waveform not the shape. There is an announcer who has significantly non-symmetrical speech waveforms and she still does after I "Remove DC." It doesn't suddenly bump up or down.

Does it do that once for the whole show? So one severely damaged waveform in the end of the show is enough to offset the whole performance? Like I drop the mic...


<<<Go to Effect > High pass filter. Set the Rolloff to 24 dB and the Cutoff Frequency to 10 Hz.>>>

And the "Q"?

Koz

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 12:40 pm
by billw58
kozikowski wrote: And the "Q"?
I just leave it at 0.7, on the theory that that will have the least ripple in the passband and the smallest hump at 10 Hz. 24 dB/octave is 80 dB/decade, so it will be down 80 dB at 1 Hz. Good enough, I figure.

-- Bill

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 5:35 pm
by kozikowski
Ripple?

Oh, Chebyshev, right?

OK. I'll be doing that for a while. I wonder if we can talk someone into making a formal filter. It's harder to recommend than the pre-formed one in Normalize.

Koz

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 5:39 pm
by kozikowski
Thinking about this for a minute, a formal filter would need to duplicate the first second of the work, apply the filter, and then remove the duplication. That gets around the First Second damage. That would, in fact deliver repaired work indistinguishable from actually capturing work with a system that had no response below 10 Hz.

Koz

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 6:42 pm
by steve
Since Patricia's issue seems to be resolved, I guess it's OK to continue along the sidetrack...
kozikowski wrote:a formal filter would need to duplicate the first second of the work, apply the filter, and then remove the duplication.

That should work in some cases, but there could be problems if the first second contains "real" audio data. In such cases, there would be a mismatch between the duplicate first second and the original first second. Even if the duplicate were reversed (so that the joining sample values match), unless you were very lucky there would still be a click at the join to cause a low frequency ripple just after the join.

Koz: Do you still have that Nyquist "Stereo Linked Normalize" that I made for you? I think I put a low frequency high pass filter in that.

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 6:58 pm
by billw58
I've got Steve Harris' "DC Offset Remover" in my plug-ins folder, but it does not present a dialog and is a LADSPA effect so I can't look at the code. His documentation says "Simply removes the DC (0 Hz) component from an audio signal, uses a high pass filter, so has some side effects, but they should be minimal."

-- Bill

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 7:01 pm
by billw58
stevethefiddle wrote:Do you still have that Nyquist "Stereo Linked Normalize" that I made for you? I think I put a low frequency high pass filter in that.
Ah, yes, "ESP Normalize". I knew I'd seen a HPF DC offset remover, but couldn't remember where. Also includes the option for a quick fade-in to cover the glitch at the start of the selection.

-- Bill

Re: clickiing noise I can't get rid of...

Posted: Mon Oct 19, 2009 10:58 pm
by steve
Thanks for reminding me of the name - found it now http://forum.audacityteam.org/viewtopic ... +ze#p46842
If I have time this week, I have a cunning plan.....