A Plug-In for LSD

You start your new plug-in for LSD by making a copy of the _Thru-folder.
Stacks Image 681
Stacks Image 682
Stacks Image 683
Then rename that folder to the name of the new effect: _Thru -> TheNewEffect
In this Demo we will build a waveshaper with Chebychev functions.
Open it and rename the files you find there, too, according to this rule:
  • tLb.TheNewEffect~.maxpat – the model, the core function of the effect
  • tLb.UITheNewEffect.maxpat – this is the slot view
  • tLb.UITheNewEffectEdit.maxpat – this is the bigger edit view
The naming scheme is important, the SelectionController depends on that.
In our case we rename the files using ChebyShaper as infix.
Then you can start editing the effect core in the tLb.TheNewEffect~ patcher:
Stacks Image 684
As indicated in the patcher window, remove the patch cords between in and out and put your own design there. The already existing patchers can guide you.
For every parameter you control with a pattr put a correspondending tLb.BindToPattr into the big edit view. This view will present every parameter you want to control. Since the space in the slot view is very limited, put only the most important controls there.

First, we add the dsp function to the patch:
A waveshaper is basically made with the lookup~ object in which you place the desired transfer function. gen17 from the PerColate collection is used as generator for the function. It is handy because it also normalizes the polynomials mix to the range between -1. … 1..
In this example we use a mix made of 8 Chebychef polynomials, whose weightings are controlled with 8 pattrs. For these pattrs we need as counterpart 8 sliders or number boxes in the user interface to set the values.
Stacks Image 716
It is possible to use tLb.BindToPattr because in the model patch a pattrmarker with the proper name is placed. This is one of the functions of tLb.InitFXEnvironment.
The small slot view patcher can be remain untouched for the moment, maybe later we place some gain control in it.

Time for a test:
But there is a problem. Look at the following setting:
Stacks Image 724
Even with zero input there will be an nonzero output, a dc offset is overlaid on the wanted signal. This makes a highpass filter in the output necessary which blocks dc. Often a so called "leaky integrator" is used to remove the dc component from the signal. This is what we will do here, too. And you might have noticed, that the harmonical content of the output depends on the amplitude of the input. Therefor some sort of gain adjustment of the input would be nice, maybe with the help of a compressor. We use omx.comp~, which is part of the MSP standard distribution.
Stacks Image 685
Stacks Image 686
tLb.Comp~ is a simple wrapper around omx.comp~.
Stacks Image 687
…and tLb.DCBlocker is a simple biquad~ filter with a feedback coefficient nearly 1., but only nearly:
Probably these coefficients were first time made public inside IRCAM's Jimmies collection, around 1997.
And finally the edit user interface, with some eye candy added:
Stacks Image 735
Stacks Image 688
To use the new plugin inside the LSD stand alone application, open its bundle and put the ChebyShaper folder into the folder AudioPlugins inside the Contents folder. After a restart of the application the plugin is available.