Hi all,

I'm thinking about putting some simple tape emulation into a few future plugins. I'm not trying to reproduce a high-end Studer - more low-end nastiness. There's a chapter in the 2nd edition of the DAFX book that describes tape echo modeling, with some useful info in it.

For my purposes, I want to get a gentle tape-esque saturation. I have seen this described in a basic form as a pre-emphasis filter, followed by a nonlinear function (usually some variant of the S-shaped transfer function we are all so fond of), followed by a de-emphasis filter.

Does anyone have any pointers to design techniques for pre/de-emphasis filters? I'm not sure if these can be approximated by simple first-order filters, or if a higher order filter needs to be used.

Thanks,

Sean Costello

P.S. Searching the KVR archives turned up this interesting thread on tape emulation:

http://www.kvraudio.com/forum/viewtopic ... &start=135

## Tape Saturation and Pre/De-emphasis filters

9 posts
• Page

**1**of**1**- KVRAF
- 3309 posts since 14 Nov, 2006, from Pacific NW

Plugins: http://www.valhalladsp.com

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

- DASH Guy
- 7234 posts since 19 Sep, 2001

Hi Sean,

for Tape Saturation usually I assume there is some hysteresis in it for getting the

"low-end nastiness"

what you describe looks more like "enhancers" : EQ>>>waveshaping>>>EQ,

for which I would use standard biquad filters, since you'd need a Q factor,

my 2C,

for Tape Saturation usually I assume there is some hysteresis in it for getting the

"low-end nastiness"

what you describe looks more like "enhancers" : EQ>>>waveshaping>>>EQ,

for which I would use standard biquad filters, since you'd need a Q factor,

my 2C,

- KVRAF
- 10969 posts since 7 Dec, 2004, from Vancouver, Canada

you can use a highpass filter, like this:

delta = input - integrator[0]

integrator[0] += delta * coefficient[0]

integrator[1] += saturation(integrator[0]) * coefficient[1] + integrator[1] * coefficient[2]

something like that. basically, integrate the highpass output after it's been saturated. this would be the "ideal" filter assuming you wanted a differentiator/integrator pair. in reality the filters are going to be approximated and adjusted to meet the specific properties of the tape head[s] and tape.

de/emphasis is just taking into account that the response of the system is non-linear with respect to frequency and attempting to compensate for that by "leveling" the frequency response. you apply the inverse of the "bad" response at the input, so when you are "inside" the system the response becomes linear. (or as desired)

once outside the system, apply the "bad" filter to bring the signal back to linear.

one interesting application to get an idea of how this works is x-law style encoding. you just apply a compressing function to the input signal, then quantize it. when you reproduce the signal, apply the reciprocal/expanding function.

for example:

compress(x) = x * (2.0 - abs(x))

expand(x) = x*abs(x)

quantized = (int)(2^bits * compress(signal))

output = expand(quantized / 2^bits)

with dither, this makes a 8 or 12 bit signal "usable" for applications like delay effects. (you probably might also want to apply a de/emphasis, but apply a lowpass to the input, and a differentiator to the output)

delta = input - integrator[0]

integrator[0] += delta * coefficient[0]

integrator[1] += saturation(integrator[0]) * coefficient[1] + integrator[1] * coefficient[2]

something like that. basically, integrate the highpass output after it's been saturated. this would be the "ideal" filter assuming you wanted a differentiator/integrator pair. in reality the filters are going to be approximated and adjusted to meet the specific properties of the tape head[s] and tape.

de/emphasis is just taking into account that the response of the system is non-linear with respect to frequency and attempting to compensate for that by "leveling" the frequency response. you apply the inverse of the "bad" response at the input, so when you are "inside" the system the response becomes linear. (or as desired)

once outside the system, apply the "bad" filter to bring the signal back to linear.

one interesting application to get an idea of how this works is x-law style encoding. you just apply a compressing function to the input signal, then quantize it. when you reproduce the signal, apply the reciprocal/expanding function.

for example:

compress(x) = x * (2.0 - abs(x))

expand(x) = x*abs(x)

quantized = (int)(2^bits * compress(signal))

output = expand(quantized / 2^bits)

with dither, this makes a 8 or 12 bit signal "usable" for applications like delay effects. (you probably might also want to apply a de/emphasis, but apply a lowpass to the input, and a differentiator to the output)

- KVRAF
- 3309 posts since 14 Nov, 2006, from Pacific NW

Thanks for the suggestions so far. Two more questions:

Most of the pre/de-emphasis filters described in analog circuits are described via time constants.

- How do you translate the time constant to frequency? (a link to a relevant web page will suffice)

- Are these filters usually shelving filters, or more of a straight lowpass/highpass filter, or...?

In the past, I've designed an allpass filter at a given frequency, and used the zero coefficients in a one-zero filter for the pre-emphasis, and the pole coefficients in a one-pole filter (with no gain normalization) for the de-emphasis. This works well, and creates a truly transparent pre/de-emphasis filter block, but I am looking at how to create something less transparent.

Sean Costello

Most of the pre/de-emphasis filters described in analog circuits are described via time constants.

- How do you translate the time constant to frequency? (a link to a relevant web page will suffice)

- Are these filters usually shelving filters, or more of a straight lowpass/highpass filter, or...?

In the past, I've designed an allpass filter at a given frequency, and used the zero coefficients in a one-zero filter for the pre-emphasis, and the pole coefficients in a one-pole filter (with no gain normalization) for the de-emphasis. This works well, and creates a truly transparent pre/de-emphasis filter block, but I am looking at how to create something less transparent.

Sean Costello

Plugins: http://www.valhalladsp.com

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

- KVRAF
- 4462 posts since 11 Feb, 2006, from Helsinki, Finland

valhallasound wrote:Thanks for the suggestions so far. Two more questions:

Most of the pre/de-emphasis filters described in analog circuits are described via time constants.

- How do you translate the time constant to frequency? (a link to a relevant web page will suffice)

Quick google found this: http://www.sengpielaudio.com/calculator ... nstant.htm

In the past, I've designed an allpass filter at a given frequency, and used the zero coefficients in a one-zero filter for the pre-emphasis, and the pole coefficients in a one-pole filter (with no gain normalization) for the de-emphasis. This works well, and creates a truly transparent pre/de-emphasis filter block, but I am looking at how to create something less transparent.

I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/de-emphasis filters); if there's non-linear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).

<- plugins | forum

- KVRAF
- 3309 posts since 14 Nov, 2006, from Pacific NW

mystran wrote:I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/de-emphasis filters); if there's non-linear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).

My allpass technique will have phase distortion, so it won't quite cascade to a wir. In the context of tape emulation that is probably just fine. And things can be essentially transparent, if you have a nonlinearity that is essentially linear for low level signal gain. For example, a hard clip will be linear for signal values that don't reach the clipping threshold. From all accounts, tape nonlinearities are closer to the standard sigmoid shape we know and love (the DAFX book uses the error function for emulating tape saturation).

Sean Costello

Plugins: http://www.valhalladsp.com

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146

- KVRAF
- 4462 posts since 11 Feb, 2006, from Helsinki, Finland

valhallasound wrote:mystran wrote:I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/de-emphasis filters); if there's non-linear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).

My allpass technique will have phase distortion, so it won't quite cascade to a wir. In the context of tape emulation that is probably just fine. And things can be essentially transparent, if you have a nonlinearity that is essentially linear for low level signal gain.

You could also just design whatever emphasis filter you want using whatever method you feel like, then swap the poles with the zeroes (or just numerator with denominator if you're lazy) so that the zeroes of the first filter cancel the poles of the second, and the poles of the first filter cancel the zeroes of the second. As long as your first filter is minimum-phase (and obviously no zeroes exactly on unit-circle), the result should be stable. If you want an all-pass instead of a wire, you can always reverse the numerator coeffs afterwards.

<- plugins | forum

- KVRAF
- 3309 posts since 14 Nov, 2006, from Pacific NW

mystran wrote:valhallasound wrote:mystran wrote:I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/de-emphasis filters); if there's non-linear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).

My allpass technique will have phase distortion, so it won't quite cascade to a wir. In the context of tape emulation that is probably just fine. And things can be essentially transparent, if you have a nonlinearity that is essentially linear for low level signal gain.

You could also just design whatever emphasis filter you want using whatever method you feel like, then swap the poles with the zeroes (or just numerator with denominator if you're lazy) so that the zeroes of the first filter cancel the poles of the second, and the poles of the first filter cancel the zeroes of the second. As long as your first filter is minimum-phase (and obviously no zeroes exactly on unit-circle), the result should be stable. If you want an all-pass instead of a wire, you can always reverse the numerator coeffs afterwards.

Interesting idea. I might try this with my 1st order shelving filters - it should be fairly quick to test.

Thanks,

Sean Costello

Blog: http://valhalladsp.wordpress.com

KVR Subforum: http://www.kvraudio.com/forum/viewforum.php?f=146