Re: [linux-audio-dev] extending LADSPA, it's not that easy ......

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] extending LADSPA, it's not that easy ......
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Wed Oct 25 2000 - 12:27:56 EEST


On Wed, 25 Oct 2000, Tom Pincince wrote:
>
> have to do with plugins? Plugins are completely useless outside of the
> context of the host. I would be happy to see plugins that did nothing
> but process one block of audio data based on one set of control data,
> and
> only allow new control data at a maximum rate equal to the block rate,
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and here lies the painful part:
it's not that easy as you might think because of two problems:
- efficiency
- audio quality

Since the rate of new control data is limited by buffer size, the method
"host calls plugin with small buffersizes and passes new control values
with each block" won't work without drawbacks:

the main problem is the zipper noise which can be caused by fast
volume fades or other kinds of parameter shifts like pan or filter sweeps.

Even if we process data in very small blocks like 32 samples, the distorsion
noise will still be in the 700Hz range. (not exactly zipper-like but still
disturbing).

The ideal would be to call plugins with blocksizes of 1sample, which would
give us zipper-free fades, but that is simply silly from an efficiency POV.

What we need is to linearly interpolate the control values inside the plugin.
(Anything more than linear interpolation gets too complex for realtime work.)

That means that the plugin needs to support parameter fading.
If you want simple linear fades you can use arbitrary high blocksizes,
otherwise,in the case that you need complex stuff like exponential fades or
arbitrary ones,
you can use buffersizes of 32-64 samples and let the host
modulate the parameters with a control rate of 350-700Hz which in turn are
sloped linearly, leading to a perceptually perfect , zipper-free result.

Ideally plugins should have a flag to tell the host if a parameter supports
linear sloping or not, and a method (a switch) to turn it off and on.
(sometimes interpolation between two subsequent control values is not desired)

Plus if you keep the buffersizes small , some plugins can greaty optimize the
parameter fading:
take a resonant low-pass filter:
using the method I described above, the plugin would need to interpolate both
resonance and cutoff which would mean a recalculation of filter coefficients
for EACH sample, which can become quite heavy.
Instead of recalculating the filter coefficients for each sample, we can
determine them for the start and end value and then slope the coefficients
linearly.
As said this utilizes the fact that you can aproximate everything with a
straight line within a short interval. (and since the rate of control data is
so low, it will be perceptually indistinguishable form the "perfect" method.

A host should act as Conrad proposed but with the addition that it should query
if the plugin has interpolation capabilities or not and/or if it requires small
blocksizes (like the lowpass filter).
That way, if an editor supports only linear sloping and the plug has this
capability and does not require small buffersizes, it can simply pass a large
buffer to the plugin for processing.
Otherwise it has to split the audio in small blocks and modulate the parameters.
But as said very fast parameter shifts will cause zipper-noise, especially
on gain plugs. (I guess the zipper is not very audible on filtersweeps)

The LADSPA docs should point out that plugs should support the parameter
interpolation in order to facilitate (in the case of linear fade segments)
parameter automation and/or to improve audio quality (for fast parameter
shifts).

And this is not only good for offline processing: realtime processing
will take advantage of the interpolation capabilities too:

take a gain plugin that is driven by a MIDI CC (with its limited 128step
resolution).
Without interpolation you can easily experience zipper noise.
Add interpolation to the gain plug and the output will be smooth, since
the plug happily interpolates between consecutive volume parameter values.

I'd like to hear what you like and do not like of this model.

Benno.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Oct 25 2000 - 16:10:23 EEST