wavedigitalfilters.lib
A library of basic adaptors and methods to help construct Wave Digital Filter models in Faust. Its official prefix is wd
.
Algebraic One Port Adaptors
(wd.)resistor
Resistor A basic adaptor implementing a resistor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree
Usage
r1(i) = resistor(i, R);
buildtree( A : r1 );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms.
Note: The adaptor must be declared as a separate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
(wd.)resistor_output
Resistor + voltage Out A basic adaptor implementing a resistor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree The resistor will also pass the voltage across itself as an output of the model
Usage
rout(i) = resistor_output(i, R);
buildtree( A : rout ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms.
Note: The adaptor must be declared as a separate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
(wd.)resistor_output_current
Resistor + current Out A basic adaptor implementing a resistor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree The resistor will also pass the current through itself as an output of the model
Usage
rout(i) = resistor_output_current(i, R);
buildtree( A : rout ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms.
Note: The adaptor must be declared as a separate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
(wd.)u_voltage
Ideal Voltage Source (Unadapted) An adaptor implementing an ideal voltage source within Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree Can be used for either DC (constant) or AC (signal) voltage sources.
Usage
v1(i) = u_Voltage(i, ein);
buildtree( v1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.ein
: Voltage/Potential across ideal voltage source in Volts
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.2
(wd.)u_current
Resistive Current Source (Unadapted) An unadapted adaptor implementing an ideal current source within Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree Can be used for either DC (constant) or AC (signal) current sources.
Usage
i1(i) = u_current(i, jin);
buildtree( i1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.jin
: Current through the ideal current source in Amps
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.3
(wd.)resVoltage
Resistive Voltage Source An adaptor implementing a resitive voltage source within Wave Digital Filter connection trees.
It should be used as a leaf/terminating element of the connection tree It is comprised of an ideal voltage source in series with a resistor Can be used for either DC (constant) or AC (signal) voltage sources.
Usage
v1(i) = resVoltage(i, R, ein);
buildtree( A : v1 );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Reistance/Impedence of the series resistor in Ohmsein
: Voltage/Potential of the ideal voltage source in Volts
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
(wd.)resVoltage_output
Resistive Voltage Source + voltage output An adaptor implementing a resitive voltage source within Wave Digital Filter connection trees.
It should be used as a leaf/terminating element of the connection tree It is comprised of an ideal voltage source in series with a resistor Can be used for either DC (constant) or AC (signal) voltage sources. The resistive voltage source will also pass the voltage across it as an output of the model
Usage
vout(i) = resVoltage_output(i, R, ein);
buildtree( A : vout ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Reistance/Impedence of the series resistor in Ohmsein
: Voltage/Potential across ideal voltage source in Volts
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
(wd.)u_resVoltage
Resistive Voltage Source (Unadapted) An unadapted adaptor implementing a resitive voltage source within Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree It is comprised of an ideal voltage source in series with a resistor Can be used for either DC (constant) or AC (signal) voltage sources.
Usage
v1(i) = u_resVoltage(i, R, ein);
buildtree( v1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Reistance/Impedence of the series resistor in Ohmsein
: Voltage/Potential across ideal voltage source in Volts
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
(wd.)resCurrent
Resistive Current Source An adaptor implementing a resitive current source within Wave Digital Filter connection trees.
It should be used as a leaf/terminating element of the connection tree It is comprised of an ideal current source in parallel with a resistor Can be used for either DC (constant) or AC (signal) current sources.
Usage
i1(i) = resCurrent(i, R, jin);
buildtree( A : i1 );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Reistance/Impedence of the parallel resistor in Ohmsjin
: Current through the ideal current source in Amps
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.5
(wd.)u_resCurrent
Resistive Current Source (Uadapted) An unadapted adaptor implementing a resitive current source within Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree It is comprised of an ideal current source in parallel with a resistor Can be used for either DC (constant) or AC (signal) current sources.
Usage
i1(i) = u_resCurrent(i, R, jin);
buildtree( i1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Reistance/Impedence of the series resistor in Ohmsjin
: Current through the ideal current source in Amps
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.5
(wd.)u_switch
Ideal Switch (Unadapted) An unadapted adaptor implementing an ideal switch for Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree
Usage
s1(i) = u_resCurrent(i, lambda);
buildtree( s1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.lambda
: switch state control. -1 for closed switch, 1 for open switch.
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.8
Reactive One Port Adaptors
(wd.)capacitor
Capacitor A basic adaptor implementing a capacitor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree This capacitor model was digitized using the bi-linear transform
Usage
c1(i) = capacitor(i, R);
buildtree( A : c1 ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Capacitance/Impedence of the capacitor being modeled in Farads.
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.1
(wd.)capacitor_output
Capacitor + voltage out A basic adaptor implementing a capacitor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree The capacitor will also pass the voltage across itself as an output of the model This capacitor model was digitized using the bi-linear transform
Usage
cout(i) = capacitor_output(i, R);
buildtree( A : cout ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Capacitance/Impedence of the capacitor being modeled in Farads.
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.1
(wd.)inductor
Inductor A basic adaptor implementing an inductor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree This inductor model was digitized using the bi-linear transform
Usage
l1(i) = inductor(i, R);
buildtree( A : l1 );
Where:
i
: index used by model-building functions. Should never be user declared.R
: Inductance/Impedence of the inductor being modeled in Henries.
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.2
(wd.)inductor_output
Inductor + Voltage out A basic adaptor implementing an inductor for use within Wave Digital Filter connection trees
It should be used as a leaf/terminating element of the connection tree The inductor will also pass the voltage across itself as an output of the model This inductor model was digitized using the bi-linear transform
Usage
lout(i) = inductor_output(i, R);
buildtree( A : lout ) : _;
Where:
i
: index used by model-building functions. Should never be user declared.R
: Inductance/Impedence of the inductor being modeled in Henries.
Note: The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.2
Nonlinear One Port Adaptors
(wd.)u_idealDiode
Ideal Diode (Unadapted) An unadapted adaptor implementing an ideal diode for Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree
Usage
buildtree( u_idealDiode : B );
Note: Only usable as the root of a tree Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 3.2.3
(wd.)u_chua
Chua Diode (Unadapted) An adaptor implementing the chua diode / non-linear resistor within Wave Digital Filter connection trees.
It should be used as the root/top element of the connection tree
Usage
chua1(i) = u_chua(i, G1, G2, V0);
buildtree( chua1 : B ) ;
Where:
i
: index used by model-building functions. Should never be user declared.G1
: resistance parameter 1 of the chua diodeG2
: resistance parameter 2 of the chua diodeV0
: voltage parameter of the chua diode
Note: Only usable as the root of a tree The adaptor must be declared as a seperate function before integration into the connection tree. Correct implementation is shown above.
Reference
Meerkotter and Scholz, "Digital Simulation of Nonlinear Circuits by Wave Digital Filter Principles"
(wd.)lambert
An implementation of the lambert function It uses Halley's method of iteration to aproximate the output Indluded in the wdf library for use in non-linear diode models adapted from K M Brigg's c++ lambert function approximator
Usage
lambert(n, itr) : _;
Where:
* n
: value at which the lambert function will be evaluated
* itr
: number of iterations before output
(wd.)u_diodePair
A pair of diodes facing in opposite directions An unadapted adaptor implementing two antiparallel diodes for Wave Digital Filter connection trees. The behavior is approximated using Schottkey's ideal diode law
Usage
d1 = u_diodePair(i, Is, Vt);
buildtree( d1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.Is
: saturation current of the diodesVt
: thermal resistances of the diodes
Note: Only usable as the root of a tree Correct implementation is shown above.
Reference
K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
(wd.)u_diodeSingle
A single diode An unadapted adaptor implementing a single diode for Wave Digital Filter connection trees. The behavior is approximated using Schottkey's ideal diode law
Usage
d1 = u_diodeSingle(i, Is, Vt);
buildtree( d1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.Is
: saturation current of the diodesVt
: thermal resistances of the diodes
Note: Only usable as the root of a tree Correct implementation is shown above.
Reference
K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
(wd.)u_diodeAntiparallel
A set of antiparallel diodes with M diodes facing forwards and N diodes facing backwards An unadapted adaptor implementing antiparallel diodes for Wave Digital Filter connection trees. The behavior is approximated using Schottkey's ideal diode law
Usage
d1 = u_diodeAntiparallel(i, Is, Vt);
buildtree( d1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.Is
: saturation current of the diodesVt
: thermal resistances of the diodes
Note: Only usable as the root of a tree Correct implementation is shown above.
Reference
K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
Two Port Adaptors
(wd.)u_parallel_2
2-port parallel adaptor (Unadapted) An unadapted adaptor implementing a 2-port parallel connection between adaptors for Wave Digital Filter connection trees. Elements connected to this adaptor will behave as if connected in parallel in circuit
Usage
buildtree( u_parallel_2 : (A, B) );
Note: Only usable as the root of a tree This adaptor has no user-accessible parameters. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
(wd.)parallel_2
2-port parallel adaptor An adaptor implementing a 2-port parallel connection between adaptors for Wave Digital Filter connection trees. Elements connected to this adaptor will behave as if connected in parallel in circuit
Usage
buildtree( A : parallel_2 : B );
Note: This adaptor has no user-accessible parameters. It should be used within the connection tree with one previous and one forward adaptor Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
(wd.)u_series_2
2-port series adaptor (Unadapted) An unadapted adaptor implementing a 2-port series connection between adaptors for Wave Digital Filter connection trees. Elements connected to this adaptor will behave as if connected in series in circuit
Usage
buildtree( u_series_2 : (A, B) );
Note: Only usable as the root of a tree This adaptor has no user-accessible parameters. Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
(wd.)series_2
2-port series adaptor An adaptor implementing a 2-port series connection between adaptors for Wave Digital Filter connection trees. Elements connected to this adaptor will behave as if connected in series in circuit
Usage
buildtree( A : series_2 : B );
Note: This adaptor has no user-accessible parameters. It should be used within the connection tree with one previous and one forward adaptor Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
(wd.)parallel_current
2-port parallel adaptor + ideal current source An adaptor implementing a 2-port series connection and internal idealized current source between adaptors for Wave Digital Filter connection trees. This adaptor connects the two connected elements and an additional ideal current source in parallel
Usage
i1 = parallel_current(i, jin);
buildtree(A : i1 : B);
Where:
i
: index used by model-building functions. Should never be user declared.jin
: Current through the ideal current source in Amps
Note: The adaptor must be declared as a seperate function before integration into the connection tree. It should be used within a connection tree with one previous and one forward adaptor Correct implementation is shown above.
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.2
(wd.)series_voltage
2-port series adaptor + ideal voltage source An adaptor implementing a 2-port series connection and internal ideal voltage source between adaptors for Wave Digital Filter connection trees. This adaptor connects the two connected adaptors and an additional ideal voltage source in series
Usage
v1 = series_voltage(i, vin)
buildtree( A : v1 : B );
Where:
i
: index used by model-building functions. Should never be user declared.vin
: voltage across the ideal current source in Volts
Note: The adaptor must be declared as a seperate function before integration into the connection tree. It should be used within the connection tree with one previous and one forward adaptor
Reference
K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.2
Three Port Adaptors
(wd.)parallel
3-port parallel adaptor An adaptor implementing a 3-port parallel connection between adaptors for Wave Digital Filter connection trees. This adaptor is used to connect adaptors simulating components connected in parallel in the circuit
Usage
buildtree( A : parallel : (B, C) );
Note: This adaptor has no user-accessible parameters. It should be used within the connection tree with one previous and two forward adaptors
Reference
K. Werner Dissertation, 1.5.1
(wd.)series
3-port series adaptor An adaptor implementing a 3-port series connection between adaptors for Wave Digital Filter connection trees. This adaptor is used to connect adaptors simulating components connected in series in the circuit
Usage
tree = A : (series : (B, C));
Note: This adaptor has no user-accessible parameters. It should be used within the connection tree with one previous and two forward adaptors
Reference
K. Werner Dissertation, 1.5.2
Model Building Functions
(wd.)builddown
function for building the strucutre for calculating waves travling down the WDF connection tree It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm It is used in conjunction with the buildup() function to create a full structure
Usage
builddown(A : B)~buildup(A : B);
Where:
* (A : B)
: is a connection tree composed of WDF adaptors
(wd.)buildup
function for building the strucutre for calculating waves travling up the WDF connection tree It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm It is used in conjunction with the builddown() function to create a full structure
Usage
builddown(A : B)~buildup(A : B);
Where:
* (A : B)
: is a connection tree composed of WDF adaptors
(wd.)getres
function for determining the upward-facing port resistance of a partial WDF connection tree It recursively steps through the given tree, parametrizes the adaptors, and builds and algorithm It is used by the buildup and builddown functions but is also helpful in testing
Usage
getres(A : B)~getres(A : B);
Where:
* (A : B)
: is a partial connection tree composed of WDF adaptors
Note: This function cannot be used on a complete WDF tree. When called on an unadapted adaptor (u_ prefix), it will create errors
(wd.)parres
function for determining the upward-facing port resistance of a partial WDF connection tree It recursively steps through the given tree, parametrizes the adaptors, and builds and algorithm It is used by the buildup and builddown functions but is also helpful in testing this function is a parallelized version of getres
Usage
parres((A , B))~parres((A , B));
Where:
* (A , B)
: is a partial connection tree composed of WDF adaptors
Note: This function cannot be used on a complete WDF tree. When called on an unadapted adaptor (u_ prefix), it will create errors
(wd.)buildout
function for creating the output matrix for a WDF connection tree It recursively steps through the given tree and creates an output matrix passing only outputs
Usage
buildout( A : B );
Where:
* (A : B)
: is a connection tree composed of WDF adaptors
(wd.)buildtree
function for building the functioning DSP model from a WDF connection tree It recursively steps through the given tree, parametrizes the adaptors, and builds the algorithm
Usage
buildtree(A : B);
Where:
* (A : B)
: a connection tree composed of WDF adaptors