BBD delay line compander

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Damn I always omit "zero delay" in low frequency stuff, but you may be right.

I gonna check this out and let you know. Intuition tells me that lpf( abs(comp[n])) approaches zero, but most probably slower and slower - asymptotically ... :) So there must be a protection against division by zero, maybe initial state >0 will be enough.

And yep: it forms sqrt shaping, its derivative is infinite at 0. Hence the problems, especially with delayed states.
Last edited by itoa on Sun Jan 24, 2016 11:00 am, edited 1 time in total.
giq

Post

Just clip minimum value to something above denormal threshold.
In C/C++ this is easy, what are you using?

Post

Yeah some kind of zero delay solve would be better.

The last line of my last message clamped the min gain of the comp feedback to -48 dB to keep it from blowing up.

In the analog circuit, I think it would usually be protected from "blowing up" because of always-present low level noise in the circuits keeping the compressor gain from getting too ridiculously high. Also, the compensated opamps usually work like a first order lowpass filter with extremely high open-loop gain at dc and unity gain around 1 MHz or whatever. And you would add safety feedback resistors in an analog circuit to limit ridiculously large quiescent gain.

Post

JCJR wrote:The last line of my last message clamped the min gain of the comp feedback to -48 dB to keep it from blowing up.
That sounds like a really good idea!

- U

Post

I ran this through Maple and this is one of the few cases where the linear solution looks much uglier IMHO than the non-linear one (which needs a simple iterative solver for one unknown). I'll try to implement it some time and post it here.

Post

It is interesting from a theoretical perspective and maybe applicable to other feedback compressor problems.

But unless there is some reason the compander has to be modeled as slavish as possible to the analog, it would be awfully tempting to just get "very near the same results" using a feedforward compressor. The feedforward one I mentioned has a divide and a SQRT per sample, but that isn't so expensive nowadays. Maybe someone smarter could even avoid the divide or SQRT.

Post

Ok,

Thanks guys,

Implemented feedback compressor (solved - no delay), this is the first test with lpf set to 15Hz, with feedback limit set to -48db. (1 sqrt + 1 division, so computation cost remains the same)

First part is the signal without compression, then its turned on. As you see the click became very adorable :)

Edit:
Ok... next level and some problems.

Regardless of input level, compressor outputs signal with amplitude of 1 (it settles down there).
Is this what should I expect?

Why asking.. Because in this case expander doesn't make any sense. It doesn't restore the original signal.
For constant level signals compressor acts like a level normalizer, so expander always get the same :)

What do you think?
You do not have the required permissions to view the files attached to this post.
giq

Post

A compander attempts to keep the signal RMS in a set range, defined by the ratio.

Post

Well... as I said, the detector of the expander works on the same signal as the detector of the compressor. One triggers division, the other one triggers multiplication. If nothing happens in-between, the output of the expander is exactly the input of the compressor. If that isn't the case, you have a bug :clown:

Code: Select all

--[/]-----+----+-----[*]-->
   ^      |    |      ^
   |      v    v      |
   +-[LP]-+    +-[LP]-+

Post

If you do the feedback compressor you don't need an explicit square root, I don't think. Putting the xpander in the feedback loop ought to perfom the square root just from the act of putting the expander in the feedback loop.

With a feedforward compressor I think you would need an explicit square root, to get the 2:1 ratio.

Post

URS:

I'm tripple checking my compressor code, seems ok

Derived from:

comp[ n ] = input[ n ] / lowpass( abs( comp[ n ] ))
(zero delay solution: y = x/(G*abs(y) + S) -> G*y * abs(y) + S*y -x = 0 -> solve )

This acts as a perfect normalizer!

e.g.
Test case:

Constant saw wave of amplitude:

0.01 -> results in constant saw wave of amplitude 1.0
0.1 -> results in constant saw wave of amplitude 1.0
0.5 -> the same

Do you see the problem now?
How expander can retrieve original amplitude when there is no knee (shaping)? Expander gets _exactly the same_ signal regardless of compressor input level.

And this the thing I'm trying to figure out. The initial model must be wrong.

It works for feedforward compressor with sqrt shaping posted by JCJR, but I want to figure out the feedback structure used in 750,751.

I'm testing this with resonable lpf settings (15-50hz)
giq

Post

I haven't gone through with the code, but for the detector I have

Lowpass: Vedt = g*(VinLP-Vdet)+s
Output: Vout = VinLP = Vin/Vdet

-->

Vdet = g*(Vin/Vdet-Vdet)+s

assuming positive

Vdet = -(Vdet^2*g-Vdet*s-Vin*g)/Vdet

which solves for Vdet

Vdet = (1/2)*(s+sqrt(4*Vin*g^2+4*Vin*g+s^2))/(g+1)

and

Vdet = -(1/2)*(-s+sqrt(4*Vin*g^2+4*Vin*g+s^2))/(g+1)

(two possible solutions, I guess the first one will be fine as everthing should always be positive)

This is how you get the output of the lowpass filter. The output of the compressor is then

Vout = Vin/Vdet

s is updated s = 2 * Vdet - s // (don't trust me during jet lag)

Post

Damn it was a bug in state update. Thanks
giq

Post

I just got around to reading that Colin Raffel paper, which seems quite well done.

He claims (and I have no reason to doubt) that the typical smoothing cap for this compander application was between 0.22 and 1 uF, which would be Time Constants from 2.2 ms up to 10 ms, rather short. Which would minimize the duration of compressor large-signal onset overshoot, but would have so much intermodulation distortion that it would sound like holy crap except that much of the distortion could be un-done by the symmetrical expander. The expander mostly reversing the ripple imparted by the compressor.

Am still puzzled about the attack being the same as the release (which seemed implied by text in one of the 571 data sheets, but its hard to say looking at the actual chip rectifier schematic).

OK I just found an appnote which validates my memory that attack was faster than release with these chips. Page 10-4 in this doc explains the attack and release characteristics. It suggests 2 uF or about 20 ms time constant for telephony use. From the appnote charts, figs 9 thru 11, it appears that the attack is less than 1 TC and the release closer to 2 TC or more. On figure 9, the one TC release level would be about -8.6 dB.

http://www.sss-mag.com/pdf/AN174.pdf

****

I suppose a proper BBD model should distort the BBD chip by over-loud overshoot spikes from the compressor.

In fact, if the overshoot spikes are big enough to temporarily clip the compressor opamp, then probably the compressor code should also hard-clip large spikes for a faithful emulation. Think I recall reading that 0 dB of a 571 was something like .775 volts rms, in the appnote example circuit.

The chip ran on single ended supply from 6 to 24 volts. In a stomp box that might be 9 volts or possibly 18 volts if the stomp box takes two batteries. In a rack device, possibly 12 or 15 volts. If the built-in opamp was typical of the time, slightly better than a 741-- It ought to clip a couple of volts short of the supply rails. So in a 9 volt stomp box, perhaps a max no more than 7 volts peak to peak before clipping-- 3.5 volts peak, 2.5 volts RMS. So on a 9 volt supply the opamp probably hard-clips around +10.5 db above the nominal 0 dB level.

Am guessing that on a good loud spike, first the opamp would hard clip, and then the BBD would continue to clip for a little while even after the compressor opamp has returned to linear operation, until the gain has settled enough to quit clipping the BBD.

****

One thing not mentioned in the article, dunno if its worth trying to emulate--

The BBD chips I experimented with, so far as I recall they needed a voltage offset trimmer resistor (bias trimmer) to put the signal in the linear range of the device. Viewed on oscilloscope, as you adjusted the trimmer, it would clip in one fashion if set too high, and clip in another fashion if set too low. So if the chorus or echo was not designed good enough, or mis-calibrated from factory, or if the calibration trimmer has drifted, you could get assymetrical clipping behavior. Or if the dc offset was set correctly for the chip, but gain-staging was set so hot that the BBD would clip, you would probably get different shaped clipping on positive and negative excursions. Can't recall the nature of the clipping difference between plus and minus. Would need checking with a scope I guess.

Some of the BBD's, such as the common SAD 1024, were built as two lines of 512 sample delay. If you wanted the cleanest signal as best I recall you could drive them differential, one line 180 degrees out of phase of the other line, and then differential amplify the two outputs. This had potential of a cleaner-clocked signal, easier to anti-alias, and the assymetrical clipping could somewhat be minimized by this method. So far as I recall

But if you needed longer delay and couldn't afford a bigger chip. Or sometimes you had to buy 100 or 1000 chips to even get a bigger chip. When 4096 and bigger BBD's first came out, and I wanted a few chips to play with, I couldn't find anybody who would sell me just 1 or 10 of them.

If all you had was a 1024 chip, you could run the two lines in series, which had more problems with clocking artifacts and distortion.

It was a fool's errand to run multiple 1024's in series to get more delay. As best I recall each chip had to be separately anti-aliased, and more than one chip in series just sounded terrible. Merely a single chip sounded pretty bad, but I suppose it is a popular bad sound. :)

Post

I wonder how "naked BBD" influences the sound (internally, besides of resampling).
I bet its not only about adding a noise and applying nonlinearity.
My intuition tells me that its strongly dependent on momentary signal amplitude e.g. the lower amplitude the more it gets smashed - like tape.

Unfortunately I have no ability to test a real device.
giq

Post Reply

Return to “DSP and Plugin Development”