Transfer Function Effect

Sometimes, a person might want to process recorded audio with a particular transfer function in the time domain, either for a particular effect, or for research. For example, I want to experiment with crossover distortion, which would compress the samples near the zero crossing. Or I might want to simulate a particular type of distortion, such as one might get from a particular kind of guitar amplifier.

If a person knew the kind of transfer function they wanted, they could simply draw it in, freehand with the mouse. Or, one might use a Bezier or curve-fit tool to help the user produce the desired result. It might be worthwhile for users to be able to enter or select from algebraic expressions as well (exponential, trignonometric, etc.)

Often, the transfer function in the third quadrant would mirror the first quadrant (e.g., class B or class A-B behavior), but to simulate single-ended or class A behavior, a full range function might be desired (i.e, everything is in the first quadrant – actually just a y-intercept offset).

Note that effects such as clippers and amplifiers are a predefined (although adjustable) form of this tool. An amplifier has a linear transfer function with an adjustable slope. A clipper has a linear transfer function with a slope of 1 up to an adjustable clip level, where the slope becomes zero. I’m envisioning an arbitrary transfer function.

Users should be able to save and load their transfer functions. Some presets might be interesting, and possibly products in their own right. For example, if someone came up with a really great Vox or Marshall Amp transfer function or whatever, that they could share with the community.

Since transfer function non-linearity can produce aliasing effects, oversampling calculations with a lowpass filter might be necessary, although a person should be able to adjust it or switch it off, if aliasing is what they want.

I have searched for this type of tool or add-in for Audacity, but have not found one. Does such a thing exist?

I’m used to using the video and Photoshop version of this tool, so I know exactly what you want, but I don’t think Audacity has anything even close.
Screen shot 2013-02-16 at 4.22.55 PM.png

Yes, I think the UI would be quite similar for drawing the transfer function. ~ Karl

Audacity has something far more versatile and powerful, but it’s not graphical:

I have the same opinion as Steve.
There are quite a few plug-ins that translate transfer functions into first or second order Biquads for example.
Although it is theoretically imaginable that such a function could be directly entered into a textbox (H=a*z(n)…) it appears to me rather unintuitive.
There are so many rules to have in mind that going the direct way over specialized functions is often better, e.g. the shape function for wave shaping.
For example, I am working on a simple distortion plug-in that lets you move the peak of a waveform to the left and right (e.g. a sawtooth becomes a triangle). That’s rather hard to put into a transfer function when you apply simultanuously soft clipping and leveling.
However, if you should stumble accidentely over a special transfer function, please post it here in the forum.

There’s the problem; the “particular” transfer function could be anything. Unless someone can come up with a very clever interface I would expect that by necessity a GUI effect would be limited to specific types of transfer functions.

Here’s a little script that you can run in the Nyquist Prompt effect.
Copy and paste this script into the text box of the Nyquist Prompt effect and apply.
The first three lines set the crossover thresholds and the amount of distortion. Change the values in these three lines as required.

(setq low -0.2) ; lower crossover non-linear threshold
(setq high 0.2) ; upper crossover non-linear threshold
(setq amount 0.8) ; amount of distortion on scale 0 to 1

(setq d0 (* (- 1 amount) low))
(setq d1 (* (- 1 amount) high))
(setq low (1+ low))
(setq high (1+ high))
(setf tf (abs-env (pwlv -1 low d0 high  d1 2 1)))
(multichan-expand #'shape s tf 1)