Tape Saturation and Pre/Deemphasis filters

valhallasound
 KVRAF
 3426 posts since 15 Nov, 2006 from Pacific NW
Tape Saturation and Pre/Deemphasis filters
Hi all,
I'm thinking about putting some simple tape emulation into a few future plugins. I'm not trying to reproduce a highend Studer  more lowend 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 tapeesque saturation. I have seen this described in a basic form as a preemphasis filter, followed by a nonlinear function (usually some variant of the Sshaped transfer function we are all so fond of), followed by a deemphasis filter.
Does anyone have any pointers to design techniques for pre/deemphasis filters? I'm not sure if these can be approximated by simple firstorder 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
I'm thinking about putting some simple tape emulation into a few future plugins. I'm not trying to reproduce a highend Studer  more lowend 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 tapeesque saturation. I have seen this described in a basic form as a preemphasis filter, followed by a nonlinear function (usually some variant of the Sshaped transfer function we are all so fond of), followed by a deemphasis filter.
Does anyone have any pointers to design techniques for pre/deemphasis filters? I'm not sure if these can be approximated by simple firstorder 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

liqih
 DASH Guy
 7271 posts since 20 Sep, 2001

aciddose
 KVRAF
 11941 posts since 7 Dec, 2004
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 and tape.
de/emphasis is just taking into account that the response of the system is nonlinear 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 xlaw 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 and tape.
de/emphasis is just taking into account that the response of the system is nonlinear 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 xlaw 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)

bootsie
 KVRian
 639 posts since 19 Apr, 2007 from Frankfurt, Germany

valhallasound
 KVRAF
 3426 posts since 15 Nov, 2006 from Pacific NW
Thanks for the suggestions so far. Two more questions:
Most of the pre/deemphasis 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 onezero filter for the preemphasis, and the pole coefficients in a onepole filter (with no gain normalization) for the deemphasis. This works well, and creates a truly transparent pre/deemphasis filter block, but I am looking at how to create something less transparent.
Sean Costello
Most of the pre/deemphasis 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 onezero filter for the preemphasis, and the pole coefficients in a onepole filter (with no gain normalization) for the deemphasis. This works well, and creates a truly transparent pre/deemphasis filter block, but I am looking at how to create something less transparent.
Sean Costello

mystran
 KVRAF
 4983 posts since 12 Feb, 2006 from Helsinki, Finland
Quick google found this: http://www.sengpielaudio.com/calculator ... nstant.htmvalhallasound wrote:Thanks for the suggestions so far. Two more questions:
Most of the pre/deemphasis 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)
I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/deemphasis filters); if there's nonlinear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).In the past, I've designed an allpass filter at a given frequency, and used the zero coefficients in a onezero filter for the preemphasis, and the pole coefficients in a onepole filter (with no gain normalization) for the deemphasis. This works well, and creates a truly transparent pre/deemphasis filter block, but I am looking at how to create something less transparent.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

valhallasound
 KVRAF
 3426 posts since 15 Nov, 2006 from Pacific NW
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).mystran wrote: I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/deemphasis filters); if there's nonlinear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).
Sean Costello

mystran
 KVRAF
 4983 posts since 12 Feb, 2006 from Helsinki, Finland
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 minimumphase (and obviously no zeroes exactly on unitcircle), the result should be stable. If you want an allpass instead of a wire, you can always reverse the numerator coeffs afterwards.valhallasound wrote: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.mystran wrote: I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/deemphasis filters); if there's nonlinear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

valhallasound
 KVRAF
 3426 posts since 15 Nov, 2006 from Pacific NW
Interesting idea. I might try this with my 1st order shelving filters  it should be fairly quick to test.mystran wrote: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 minimumphase (and obviously no zeroes exactly on unitcircle), the result should be stable. If you want an allpass instead of a wire, you can always reverse the numerator coeffs afterwards.valhallasound wrote: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.mystran wrote: I don't think you necessarily want the filters themselves to not be transparent (at least not the pre/deemphasis filters); if there's nonlinear processing in between, the result won't be transparent anyway (even if the filters cascade to a wire).
Thanks,
Sean Costello