Re: ducking audio
Re: ducking audio
- Subject: Re: ducking audio
- From: Brian Willoughby <email@hidden>
- Date: Fri, 17 Oct 2008 04:03:49 -0700
On Oct 16, 2008, at 23:51, John Clayton wrote:
Does anyone have some tips as to how I can approach audio ducking
using Core Audio? I believe its basically as simple as multiplying
the PCM values by some rate before letting them pass through on
their way to the final destination.
Is it possible to add a side-chain to a unit so that this happens
auto-magically? Any links / tips appreciated .
Nothing is going to happen automatically just by adding a side-chain,
despite the appearance given by the fact that most released plugins
in the marketplace which support a side-chain happen to use it for
similar purposes. The reality is that adding a side-chain could be
for spectogram display only, or vocoding, or any other purpose. In
fact, if you don't write your AU code correctly, adding a side-chain
could do nothing at all. Certainly, folks in our community have had
trouble adding a second bus input. In other words, I may have
misunderstood your final question, but nothing comes free in this
respect.
However, you're basically right: Multiplication is one of the
fundamental operations in ducking. In fact, any gain change - such
as a simple fader - is implemented by multiplication. Fractional
values less than 1.0 would correspond to a drop in decibel level,
anything above 1.0 would be a boost. But these examples are
basically constant, unless you're riding the gain in the UI
continuously, or automating the multiplication factor.
Ducking becomes a little more complex than static gain for a couple
of reasons. First of all, you'll need to determine the apparent
volume level of the control audio, and then assign a value which you
invert such that louder passages on the side-chain result in lower
gain on the pass-through of the main input. There are a variety of
algorithms for computing apparent volume, usually a running average
like RMS, taken over a long enough period of time - say 300 ms - to
approximate human perception. There are more complex and accurate
algorithms, but they're probably overkill for ducking. The point is
that there is more than one way to handle the volume detection. You
might also want to implement some sort of EQ on the incoming audio,
in case you only want to duck when certain potentially masking
frequencies are present in the control audio. All or most of the
above may be fairly obvious to anyone familiar with analog ducking
equipment. The following might be less apparent, though.
The second complexity of ducking is due to the artifacts which occur
when multiplying two signals. This problem appears with any dynamics
processing. Basically, if your control signal reaches audio
frequencies (20Hz), and perhaps even if it doesn't, you can get
Intermodulation Distortion (IMD). Mathematically, multiplying two
signals together, of frequencies A and B, results in an output signal
which no longer contains frequencies A and B, but rather replaces
them with the frequencies A+B and A-B, or the sum and difference of
the original frequencies. If B is your ducking volume control
signal, it must remain as close to DC as possible, or stay at such
low frequencies so as not to distort the original frequency A of the
signal that you want ducked. One very interesting potential artifact
in digital audio, due to its discrete nature, is that any sudden jump
in level corresponds to a square wave, which is an infinite series of
sin waves, each of which is producing a distorted copy of the
original signal. You might imagine that producing a very smooth
ducking effect which is free from harsh 'digital' distortion could
prove quite difficult!
Good luck. "All" you have to do is implement an additional bus on
your AU, process the incoming audio to a control signal (CV), and
implement a dynamic gain control that follows the inverse of the
control audio's volume.
Brian Willoughby
Sound Consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden