[sdiy] Lin/Log VCAs and envelopes - compensating for log VCAs

Richie Burnett rburnett at richieburnett.co.uk
Sun Feb 7 00:18:24 CET 2016


The IIR filter calculation only takes two or three instructions on a DSP but is quite costly on a low-end microcontroller without hardware multiply.  You need quite an extended precision in the accumulator too to stop limit-cycle behaviour with a loooooong decay setting.

There's also the issue of generating the IIR filter coefficient from the attack/decay/release control panel settings. This is another job that is trivial to do with a polynomial approximation on a DSP, but will probably need a lookup table anyway on a low-end micro.

Tom, have you looked into using an exponential approximation like the piecewise linear algorithm using bit shifts that Eric Brombaugh mentioned a little while ago? This would save you a load of LUT memory, whilst only requiring basic CPU instructions to implement. It's a piecewise approximation to exponential with linear segments for each "octave" but likely good enough conformity for rock and roll. I have a feeling this is how the Juno 106 generates it's software envelopes because the decay and release phases look piecewise linear to me.

-Richie, 

Sent from my Xperia SP on O2

---- Tom Wiltshire wrote ----

>
>On 6 Feb 2016, at 22:06, rsdio at audiobanshee.com wrote:
>
>> 
>> On Feb 6, 2016, at 11:08 AM, Tom Wiltshire <tom at electricdruid.net> wrote:
>>> To be honest, this doesn't look exceptionally "natural" to me. But I don't think I'm going to argue with 50 years of synth history. If that's what we like, that's what we like.
>>> 
>>> Now, what I'm thinking is that I could easily tweak the tables in one of my PIC envelope generators to give these "log" curves. I could then feed the envelope to a log VCA and get the same sound you get with a typical ADSR into a OTA/linear VCA. It's a "log-compensated" envelope. Being able to switch between the two curves would enable people to use either a log or linear VCA and still get the same effect.
>>> 
>>> What do you all think?
>> 
>> Although tables can be a great implementation choice for many PIC tasks, it might actually be better to use a single pole low-pass filter for your ADSR. That perfectly recreates an RC charging / discharging circuit without requiring a linear-to-logarithmic lookup. Besides, if you have a 16-bit DAC, you probably don't have room for a table large enough to hold all 64K possible log outputs. Even a 10-bit DAC would skip a lot of output codes unless your lookup table were significantly larger than 1K entries (probably at least 8K needed). The low-pass code will require a couple of multiply instructions, but most PIC chips can handle that. If you were programming a DSP chip, you'd be set.
>
>Hi Brian,
>
>A single-pole IIR is a possibility that I've recently looked into, but for other jobs. The problem is that it's only efficient if you limit the coefficients to what you can do using shifts. Otherwise, you have to do multi-byte multiplication, which means a look-up is definitely more efficient. On 18F chips or dsPICs, you're probably right, but I've been working on 12F and 16F chips with no multiply instruction, so it's a *big* cost. On my envelope generators, I've used a 256-entry look-up plus a linear interpolation - this is the same cost as a basic single byte multiplication, which still gives a gain over IIR, and also gives you arbitrary envelope curves. You can easily extend a 256-entry table to 12 or 14-bits without anyone detecting that it isn't curved. Note also that even a 64K table will miss some output values if the output is non-linear, as our example is.
>
>My usual rule of thumb for these basic chips is "Don't do hard sums" !
>
>Tom
>
>
>
>_______________________________________________
>Synth-diy mailing list
>Synth-diy at dropmix.xs4all.nl
>http://dropmix.xs4all.nl/mailman/listinfo/synth-diy


More information about the Synth-diy mailing list