[music-dsp] pitch modification to audio files + compressor

James Chandler Jr jchandjr at bellsouth.net
Thu Jun 7 12:45:34 EDT 2001


> There was also a discussion about compressor recently.
> I played a little with this under Matlab.
> I simply low-pass filtered the input full-rectified envelope with a
unitary
> gain low-pass filter, and changed the coefficient to switch between attack
> and release.
> Filter:
> with a = 1-2*Ts/Tr  (approximation)
> (Ts = sampling period, Tr = response time, attack or release),
> H(z) = (1 - a) / (1 - a*z^-1) in Z domain, or
> y(n) = (1-a)*x(n) + a*y(n-1) in time domain
> Attack and Release time correspond to 2 different coefficients a.
> To determine when is attack, and when is release, I just made the
difference
> between the output and the input of the filter: positive means release,
> negative means attack.

I've been using a similar one-pole filter approach for envelope
attack-release.

Drawing from analog compressor experience, I visualized it as two
charge-discharge resistors, diode-steered into a capacitor. But my emulation
of an analog A-R circuit is just about identical to your method.

Have used cascaded single-pole envelope smoothers, for "program adaptive"
envelopes. Envelopes that release quickly to a quick transient, but release
more slowly to sustained transients.

Unfortunately, several cascaded single-pole envelopes still allow a fair
amount of low-freq ripple in the control signal. This isn't much of a
problem in a sane compressor, but can cause pretty bad IM distortion in a
heavily-driven limiter.

Lookahead on the envelopes can further reduce the ripple. A multi-stage
envelope with lookahead can hard-limit very heavily without IM distortion.

Have been wanting to try a higher-order lowpass filter, switching out the
coefficients for attack-release as in your example. A four-pole, Q=0.707
filter ought to smooth envelope ripple much more effectively than cascaded
single-pole sections, assuming that the filter would not go crazy by getting
its coefficients constantly swapped around.

Once you add the complication of a Q path in the filter, I don't have a good
theoretical grasp of what kind of nastiness might result at the boundaries
of coefficient switching.

If I get a chance to try it, will let the list know.

But if some expert already knows the answer, the info would be very welcome
(G).

James Chandler Jr.




dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/




More information about the music-dsp mailing list