* Z:\home\khalils\Downloads\files\data\raw_asc\334c1dc8507a_KOT_stack.asc
* Generated by LTspice 26.0.1 for Windows.
* vovxblt = gdsp2*(X0blt*z1 + 1)./(Y0blt*z1 + 1);
* vxviblt = gdsp.*(A2blt*z2 + A1blt*z1 + 1) / ( B2blt*z2 + B1blt*z1 + 1)
* IIR Coefficients and gains
* Analog filter coefficients and gains
* Intermediate variable substitutions in analog filter coefficient computation
* Sampling constants
* Bilinear Transform Constant
* // First-order high pass filter coefficients\n// H(z) = g * (1 - z^-1)/(1 - a1*z^-1)\n// Direct Form 1:\n// h[n] = g * ( b0*x[n] - b1*x[n-1] ) - a1*y[n-1]\n// In below implementation gain is redistributed to the numerator:\n// h[n] = g*x[n] - g*x[n-1] - a1*y[n-1]\na1 = -expf(-w0);\ng = (1.0 - a1)*0.5;\nb0 = g;\nb1 = -g;
* // First-order low pass filter coefficients\n// H(z) = g * (1 - z^-1)/(1 - a1*z^-1)\n// Direct Form 1:\n// h[n] = g * ( b0*x[n] - b1*x[n-1] ) - a1*y[n-1]\n// In below implementation gain is redistributed to the numerator:\n// h[n] = gb0*x[n] - gb1*x[n-1] - a1*y[n-1]\na1 = -expf(-w0);\ng = (1.0 + a1)/1.12;\nb0 = g;\nb1 = 0.12*g; //0.12 zero improves RC filter emulation at higher freqs.
* .param a31 = -exp(-w3/fs);\n.param b30 = 1-exp(-w3/fs);;\n.param b31 = 0.0;
* 1-pole, no zero simple low-pass \nfilter implementation
* Add zero to improve\nRC filter match near\nfs/2
* TONE STACK IIR FILTER IMPLEMENTATION
* R7, C5 Pole (high-pass)
* R8, C6 Pole (high-pass)
* Pot/R7 gain
* Pot/R8 gain
* Clipping stage gain
* Gain pot\nMin gain resistor series to gain pot
* Gain pot rotation, A-leg resistance ratio (0 to 1)\nGain pot B-leg resistance ratio
* Gain pot, resistor, C4 Pole (low-pass)
* R7 current
* R8 current
* = -------------------
* s*C5
* Rfb = R6 + RdriveA
* Rfb
* s*Rfb*C4 + 1
* --------------------
* s*C5
* s*R7*C5 + 1
* --------------------
* *
* +
* s*C6
* s*R8*C6 + 1
* --------------------
* \\\n |\n |\n/
* /\n|\n|\n\\
* + 1
* V(vgain_pre)\n-------------------- =\n V(vinr)
* s*R7*C5 + 1
* --------------
* I(R7)
* V(vinr)
* = -------------------
* s*C6
* s*R8*C6 + 1
* --------------
* I(R8)
* V(vinr)
* = ----------------------
* s*C7
* s*Rfeed*C7 + 1
* ------------
* I(R8)
* V(vinr)
* Rfeed = R9 + RdriveB
* Rfb
* s*Rfb*C4 + 1
* --------------------
* s*C5
* s*R7*C5 + 1
* --------------------
* *
* +
* s*C6
* s*R8*C6 + 1
* --------------------
* \\\n |\n |\n/
* + 1
* /\n|\n|\n\\
* /\n|\n|\n\\
* \\\n |\n |\n/
* *
* s*R10*C7
* s*Rfeed*C7 + 1
* ----------------------
* V(vgain)\n--------------- =\n V(vinr)
* 1rst-order HPF
* 1rst-order HPF
* 1rst-order HPF
* 1rst-order LPF
* TONESTACK DIGITIZED WITH BILINEAR TRANSFORMATION
* GAIN STAGES CAN BE DIGITIZED BY INSPECTION USING CASCADED FIRST-ORDER IIR FILTERS
* STIMULUS
* KING OF TONE -- FREQUENCY DOMAIN ANALYSIS
* COMPARISON OF DIGITIZED IIR AND CONTINUOUS TIME TRANSFER FUNCTIONS
* DSP SIMULATION
* SPICE LAPLACE DIRECTIVE IN BEHAVIORAL VOLTAGE AND CURRENT SOURCES\nALLOWS DIRECT IMPLEMENTATION OF THE IIR FILTERS WHICH CAN BE \nCOMPARED DIRECTLY TO THE ANALOG PROTOTYPE CIRCUIT:\nz^-1 = e^(-sT)
* Pot rotation position, Tone\nPot rotation position, Boost
* R12
* Tone Pot (RtoneA, RtoneB)
* Boost Pot (Rboost)
* C8\nC9
* Volume pot parallel output pull-down resistor
* Intermediate computation value for Boost Pot
* R13
* Intermediate computation value for Tone Pot, lower leg. Param rtone/fs to prevent 0 resistance which creates divide by zero
* Intermediate computation value for Tone Pot, upper leg, and series feed resistor
* Pot rotation position, Tone, alternate resistance leg to wiper
* High-pass function of C3, R5 neglected because it is 16 Hz cut-off. \nDC blocking going into the audio interface is likely similar.\nIn both cases, negligible in bands where tone of the circuit is shaped.
* Library below included based on ModelFile attribute of instance XU1, XU2 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\UniversalOpAmp2.asy)
B5 pre3 N012 V=V(pre2) Laplace=(b31*exp(-s*Ts) + b30)/(a31*exp(-s*Ts) + 1)
R6 N007 N006 {rgser}
R8 N010 N006 27k
RdriveA vgain_pre N007 {rgpot*gpos+1u}
B6 N012 0 V=V(vinr)
C6 0 N010 10n
R5 vinr vbias 1Meg
R7 N005 N006 33k
R10 vgain N004 220k
B2 Hz 0 V=-V(vovxblt)*gdsp Laplace=(A2blt*exp(-s*2*Ts) + A1blt*exp(-s*Ts) + 1) / ( B2blt*exp(-s*2*Ts) + B1blt*exp(-s*Ts) + 1)
D5 N002 N001 1N914
RdriveB N008 vgain_pre {rgpot*igpos+1u}
C9 p2 0 {c2}
D7 vbias N011 1N914
R11 N001 N004 6.8k
C4 vgain_pre N006 100p
V2 vbias 0 4.5
R9 N009 N008 {rgser}
Rboost p2 Hs {rd+1u}
B3 pre1 0 V=V(vinr)*gx1 Laplace=(b11*exp(-s*Ts) + b10)/(a11*exp(-s*Ts) + 1)
B1 vovxblt 0 V=V(pre4)*gdsp2 Laplace=(X0blt*exp(-s*Ts) + 1)/(Y0blt*exp(-s*Ts) + 1)
B7 pre4 0 V=V(pre3)*gx3 Laplace=(b41*exp(-s*Ts) + b40)/(a41*exp(-s*Ts) + 1)
Ro 0 Hs {ro}
B4 pre2 pre1 V=V(vinr)*gx2 Laplace=(b21*exp(-s*Ts) + b20)/(a21*exp(-s*Ts) + 1)
C3 vinr vin 10n
D4 vgain N002 1N914
R13 Hs vx {rc}
D6 N011 vbias 1N914
C5 0 N005 10n
RtoneB p1 vx {rb}
XU2 vbias N004 vcc 0 vgain level2 Avol=1Meg GBW=10Meg Slew=10Meg Ilimit=25m Rail=0 Vos=0 En=0 Enk=0 In=0 Ink=0 Rin=500Meg ;pnba In+)In-)V+)V-)OUT
XU1 vinr N006 vcc 0 vgain_pre level2 Avol=1Meg GBW=10Meg Slew=10Meg Ilimit=25m Rail=0 Vos=0 En=0 Enk=0 In=0 Ink=0 Rin=500Meg ;pnba In+)In-)V+)V-)OUT
R12 N011 vgain {ri}
RtoneA vx N011 {rtone*apos+1u}
V1 vin 0 0 AC 1
C7 N004 N009 100n
D2 N001 N003 1N914
D3 N003 vgain 1N914
V3 vcc vbias 4.5
C8 p1 0 {c1}
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.ac oct 100 20 22050
.step param apos list 0.05 0.5 0.95
.step param bstpos list 0.05 0.5 0.95
.param bpos { 1 - apos}
.param ri {1k}
.param rtone {25k}
.param rboost {50k}
.param ra {ri + apos*rtone}
.param rb {bpos*rtone + rtone/fs}
.param rc {6.8k}
.param rd {rboost*bstpos}
.param ro {100k*1000k/(100k + 1000k)}
.param c1 {10n}
.param c2 {10n}
.param fs 44100
.param Ts {1/fs}
.param aa0 {ro + rc}
.param aa1 {(ro + rd)*rc*c2 + ro*rd*c2}
.param bb1 {(ro+rd)*c2}
.param N0 {aa0}
.param N1 {rb*c1*aa0 + aa1}
.param N2 {rb*c1*aa1}
.param D0 {1}
.param D1 {rb*c1 + c1*aa0 + bb1}
.param D2 {rb*c1*bb1 + c1*aa1}
.param gvx {N2/(N2 + ra*D2)}
.param A0 {N0/N2}
.param A1 {N1/N2}
.param B0 {(N0 + ra*D0)/(N2 + ra*D2)}
.param B1 {(N1 + ra*D1)/(N2 + ra*D2)}
.param gvo {(c2*ro*rd)/(c2*(ro*rd+(ro+rd)*rc))}
.param X0 {1/(c2*rd )}
.param Y0 {(rc + ro)/(c2*(ro*rd+(ro+rd)*rc))}
.param gblt {((A0 + kx*A1 + kx*kx)/(B0 + kx*B1 +kx*kx))}
.param gdsp {gvx*gblt}
.param A1blt {((2*A0-2*kx*kx)/(A0+kx*A1+kx*kx))}
.param A2blt {((A0-kx*A1+kx*kx)/(A0+kx*A1+kx*kx))}
.param B1blt {((2*B0-2*kx*kx)/(B0+kx*B1+kx*kx))}
.param B2blt {((B0-kx*B1+kx*kx)/(B0+kx*B1+kx*kx))}
.param g2blt {(X0 + kx)/(Y0 + kx)}
.param gdsp2 {gvo*g2blt}
.param X0blt {(X0 - kx)/(X0 + kx)}
.param Y0blt {(Y0 - kx)/(Y0 + kx)}
.param kx {2*fs}
.param w1 {1/(33k*10n)}
.param w2 {1/(27k*10n)}
.param a11 = -exp(-w1/fs);
.param g1 = (1.0 - a11)*0.5;
.param b10 = g1;
.param b11 = -g1;
.param a21 = -exp(-w2/fs);
.param g2 = (1.0 - a21)*0.5;
.param b20 = g2;
.param b21 = -g2;
.param rgpot 100k
.param rgser 10k
.param gpos 1.0
.param igpos {1-gpos}
.param gx1 {(rgser + rgpot*gpos)/33k}
.param gx2 {(rgser + rgpot*gpos)/27k}
.param w3 {1/(110k*100p)}
.param w4 {1/((rgser+rgpot*igpos)*100n)}
.param a41 = -exp(-w4/fs);
.param g4 = (1.0 - a41)*0.5;
.param b40 = g4;
.param b41 = -g4;
.param gx3 {220k/(rgser + rgpot*igpos)}
.param a31 = -exp(-w3/fs);
.param g3 = (1.0 + a31)/1.12;
.param b30 = g3;
.param b31 = 0.12*g3;
.lib UniversalOpAmp2.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 5436 3268
WIRE 1744 -3504 1584 -3504
WIRE 1872 -3504 1808 -3504
WIRE 2016 -3504 1936 -3504
WIRE 1584 -3392 1584 -3504
WIRE 1760 -3392 1584 -3392
WIRE 1888 -3392 1824 -3392
WIRE 2016 -3392 2016 -3504
WIRE 2016 -3392 1952 -3392
WIRE 1584 -3312 1584 -3392
WIRE 1584 -3136 1584 -3232
WIRE 1760 -3136 1584 -3136
WIRE 2016 -3136 2016 -3392
WIRE 2016 -3136 1840 -3136
WIRE 1056 -3024 1024 -3024
WIRE 1792 -2992 1760 -2992
WIRE 1760 -2912 1760 -2992
WIRE 272 -2896 80 -2896
WIRE 400 -2896 336 -2896
WIRE 656 -2896 480 -2896
WIRE 720 -2896 656 -2896
WIRE 864 -2896 800 -2896
WIRE 1024 -2896 1024 -3024
WIRE 1024 -2896 944 -2896
WIRE 1104 -2896 1024 -2896
WIRE 1280 -2896 1184 -2896
WIRE 1424 -2896 1360 -2896
WIRE 1584 -2896 1584 -3136
WIRE 1584 -2896 1488 -2896
WIRE 1728 -2896 1584 -2896
WIRE 2016 -2880 2016 -3136
WIRE 2016 -2880 1792 -2880
WIRE 2080 -2880 2016 -2880
WIRE 1728 -2864 1696 -2864
WIRE 80 -2784 80 -2896
WIRE 272 -2784 80 -2784
WIRE 400 -2784 336 -2784
WIRE 656 -2784 656 -2896
WIRE 656 -2784 480 -2784
WIRE 784 -2784 656 -2784
WIRE 1024 -2784 1024 -2896
WIRE 1024 -2784 848 -2784
WIRE 1760 -2784 1760 -2848
WIRE 80 -2720 80 -2784
WIRE 784 -2688 752 -2688
WIRE 752 -2608 752 -2688
WIRE 656 -2592 656 -2784
WIRE 720 -2592 656 -2592
WIRE 1024 -2576 1024 -2784
WIRE 1024 -2576 784 -2576
WIRE 448 -2560 368 -2560
WIRE 576 -2560 512 -2560
WIRE 608 -2560 576 -2560
WIRE 720 -2560 608 -2560
WIRE 1712 -2512 1616 -2512
WIRE 1856 -2512 1776 -2512
WIRE 1984 -2512 1856 -2512
WIRE 608 -2496 608 -2560
WIRE 752 -2480 752 -2544
WIRE 1488 -2400 1424 -2400
WIRE 1616 -2400 1616 -2512
WIRE 1616 -2400 1568 -2400
WIRE 1728 -2400 1616 -2400
WIRE 1856 -2400 1856 -2512
WIRE 1856 -2400 1792 -2400
WIRE 608 -2352 608 -2416
WIRE 640 -2352 608 -2352
WIRE 1616 -2256 1616 -2400
WIRE 1616 -2128 1616 -2176
WIRE 1712 -2128 1616 -2128
WIRE 1824 -2128 1712 -2128
WIRE 2016 -2128 1904 -2128
WIRE 2320 -2128 2016 -2128
WIRE 2368 -2128 2320 -2128
WIRE 1616 -2064 1616 -2128
WIRE 2016 -2016 2016 -2128
WIRE 2320 -1952 2320 -2128
WIRE 1616 -1920 1616 -1984
WIRE 1616 -1920 1568 -1920
WIRE 2016 -1888 2016 -1936
WIRE 2016 -1888 1968 -1888
WIRE 272 -1872 160 -1872
WIRE -32 -1856 -208 -1856
WIRE 1616 -1856 1616 -1920
WIRE 2016 -1856 2016 -1888
WIRE -208 -1776 -208 -1856
WIRE 160 -1728 160 -1872
WIRE 1616 -1680 1616 -1792
WIRE 2016 -1680 2016 -1792
WIRE 2016 -1680 1616 -1680
WIRE 2320 -1680 2320 -1872
WIRE 2320 -1680 2016 -1680
WIRE -208 -1664 -208 -1696
WIRE -176 -1664 -208 -1664
WIRE 2320 -1664 2320 -1680
WIRE -208 -1616 -208 -1664
WIRE 160 -1520 160 -1648
WIRE -208 -1424 -208 -1536
WIRE 448 432 352 432
WIRE 1808 432 1712 432
WIRE 3040 448 2944 448
WIRE 352 512 352 432
WIRE 1712 512 1712 432
WIRE 2944 528 2944 448
WIRE 352 672 352 592
WIRE 448 672 352 672
WIRE 1712 704 1712 592
WIRE 2944 720 2944 608
WIRE 352 752 352 672
WIRE 1712 896 1712 784
WIRE 352 912 352 832
WIRE 432 1328 336 1328
WIRE 336 1408 336 1328
WIRE 336 1568 336 1488
WIRE 400 1920 304 1920
WIRE 304 2000 304 1920
WIRE 304 2160 304 2080
RECTANGLE Normal 3088 2464 96 1264 2
SYMBOL bv 1712 496 R0
SYMATTR InstName B5
SYMATTR Value V=V(pre2) Laplace=(b31*exp(-s*Ts) + b30)/(a31*exp(-s*Ts) + 1)
SYMBOL voltage -208 -1792 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 4.5
SYMBOL cap 272 -2768 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName C6
SYMATTR Value 10n
SYMBOL diode 1936 -3520 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D4
SYMATTR Value 1N914
SYMBOL cap 272 -2880 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName C5
SYMATTR Value 10n
SYMBOL bv 336 1392 R0
SYMATTR InstName B1
SYMATTR Value V=V(pre4)*gdsp2 Laplace=(X0blt*exp(-s*Ts) + 1)/(Y0blt*exp(-s*Ts) + 1)
SYMBOL diode 1728 -2384 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D6
SYMATTR Value 1N914
SYMBOL res 1568 -3328 R0
SYMATTR InstName R11
SYMATTR Value 6.8k
SYMBOL res 592 -2512 R0
SYMATTR InstName R5
SYMATTR Value 1Meg
SYMBOL res 1920 -2144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R13
SYMATTR Value {rc}
SYMBOL bv 1712 688 R0
SYMATTR InstName B6
SYMATTR Value V=V(vinr)
SYMBOL bv 304 1984 R0
SYMATTR InstName B2
SYMATTR Value V=-V(vovxblt)*gdsp Laplace=(A2blt*exp(-s*2*Ts) + A1blt*exp(-s*Ts) + 1) / ( B2blt*exp(-s*2*Ts) + B1blt*exp(-s*Ts) + 1)
SYMBOL diode 1776 -2528 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D7
SYMATTR Value 1N914
SYMBOL res 1632 -1968 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName RtoneB
SYMATTR Value {rb}
SYMBOL bv 2944 512 R0
SYMATTR InstName B7
SYMATTR Value V=V(pre3)*gx3 Laplace=(b41*exp(-s*Ts) + b40)/(a41*exp(-s*Ts) + 1)
SYMBOL bv 352 496 R0
SYMATTR InstName B4
SYMATTR Value V=V(vinr)*gx2 Laplace=(b21*exp(-s*Ts) + b20)/(a21*exp(-s*Ts) + 1)
SYMBOL res 816 -2912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R6
SYMATTR Value {rgser}
SYMBOL cap 848 -2800 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C4
SYMATTR Value 100p
SYMBOL res 384 -2768 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R8
SYMATTR Value 27k
SYMBOL Opamps\\UniversalOpamp2 1760 -2880 R0
SYMATTR InstName U2
SYMBOL res 2336 -1856 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName Ro
SYMATTR Value {ro}
SYMBOL res 1584 -2416 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R12
SYMATTR Value {ri}
SYMBOL diode 1760 -3376 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value 1N914
SYMBOL res 1632 -2160 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName RtoneA
SYMATTR Value {rtone*apos+1u}
SYMBOL res 1856 -3152 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R10
SYMATTR Value 220k
SYMBOL cap 1488 -2912 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C7
SYMATTR Value 100n
SYMBOL res 1200 -2912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName RdriveB
SYMATTR Value {rgpot*igpos+1u}
SYMBOL cap 1600 -1856 R0
SYMATTR InstName C8
SYMATTR Value {c1}
SYMBOL Opamps\\UniversalOpamp2 752 -2576 R0
SYMATTR InstName U1
SYMBOL diode 1888 -3376 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D3
SYMATTR Value 1N914
SYMBOL res 960 -2912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName RdriveA
SYMATTR Value {rgpot*gpos+1u}
SYMBOL diode 1808 -3520 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D5
SYMATTR Value 1N914
SYMBOL voltage 160 -1744 R0
WINDOW 123 24 124 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value2 AC 1
SYMATTR InstName V1
SYMATTR Value 0
SYMBOL res 1376 -2912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R9
SYMATTR Value {rgser}
SYMBOL cap 512 -2576 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C3
SYMATTR Value 10n
SYMBOL cap 2000 -1856 R0
SYMATTR InstName C9
SYMATTR Value {c2}
SYMBOL bv 352 736 R0
SYMATTR InstName B3
SYMATTR Value V=V(vinr)*gx1 Laplace=(b11*exp(-s*Ts) + b10)/(a11*exp(-s*Ts) + 1)
SYMBOL voltage -208 -1632 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value 4.5
SYMBOL res 384 -2880 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R7
SYMATTR Value 33k
SYMBOL res 2032 -1920 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName Rboost
SYMATTR Value {rd+1u}
FLAG 2320 -1664 0
FLAG 1424 -2400 vgain
FLAG 2368 -2128 Hs
FLAG 160 -1520 0
FLAG 272 -1872 vin
FLAG 1712 -2128 vx
FLAG 1568 -1920 p1
FLAG 1968 -1888 p2
FLAG 336 1568 0
FLAG 432 1328 vovxblt
FLAG 304 2160 0
FLAG 400 1920 Hz
FLAG 352 912 0
FLAG 448 672 pre1
FLAG 448 432 pre2
FLAG 1808 432 pre3
FLAG 1712 896 0
FLAG 3040 448 pre4
FLAG 2944 720 0
FLAG 752 -2480 0
FLAG 784 -2688 vcc
FLAG 368 -2560 vin
FLAG 640 -2352 vbias
FLAG 1760 -2784 0
FLAG 1792 -2992 vcc
FLAG 1696 -2864 vbias
FLAG 80 -2720 0
FLAG 2080 -2880 vgain
FLAG -208 -1424 0
FLAG -176 -1664 vbias
FLAG -32 -1856 vcc
FLAG 576 -2560 vinr
FLAG 1056 -3024 vgain_pre
FLAG 1984 -2512 vbias
TEXT 56 -1432 Left 2 !.ac oct 100 20 22050
TEXT 2704 -1736 Left 2 !.step param apos list 0.05 0.5 0.95\n.step param bstpos list 0.05 0.5 0.95\n.param bpos { 1 - apos}
TEXT 2712 -2056 Left 2 !.param ri {1k}    \n.param rtone {25k}\n.param rboost {50k} \n.param ra {ri + apos*rtone}\n.param rb {bpos*rtone + rtone/fs}\n.param rc {6.8k}\n.param rd {rboost*bstpos}\n.param ro {100k*1000k/(100k + 1000k)}\n.param c1 {10n}\n.param c2 {10n}
TEXT 1568 1376 Left 2 !.param fs 44100\n.param Ts {1/fs}
TEXT 2056 1368 Left 2 !.param aa0 {ro + rc}\n.param aa1 {(ro + rd)*rc*c2 + ro*rd*c2}\n.param bb1 {(ro+rd)*c2}
TEXT 2056 1536 Left 2 !.param N0 {aa0}\n.param N1 {rb*c1*aa0 + aa1}\n.param N2 {rb*c1*aa1}\n.param D0 {1}\n.param D1 {rb*c1 + c1*aa0 + bb1}\n.param D2 {rb*c1*bb1 + c1*aa1}
TEXT 2064 1728 Left 2 !.param gvx {N2/(N2 + ra*D2)}\n.param A0 {N0/N2}\n.param A1 {N1/N2}\n.param B0 {(N0 + ra*D0)/(N2 + ra*D2)}\n.param B1 {(N1 + ra*D1)/(N2 + ra*D2)}\n.param gvo {(c2*ro*rd)/(c2*(ro*rd+(ro+rd)*rc))}
TEXT 2064 1896 Left 2 !.param X0 {1/(c2*rd )}\n.param Y0 {(rc + ro)/(c2*(ro*rd+(ro+rd)*rc))}
TEXT 2056 2016 Left 2 !.param gblt {((A0 + kx*A1 + kx*kx)/(B0 + kx*B1 +kx*kx))}\n.param gdsp {gvx*gblt}\n.param A1blt {((2*A0-2*kx*kx)/(A0+kx*A1+kx*kx))}\n.param A2blt {((A0-kx*A1+kx*kx)/(A0+kx*A1+kx*kx))}\n.param B1blt {((2*B0-2*kx*kx)/(B0+kx*B1+kx*kx))}\n.param B2blt {((B0-kx*B1+kx*kx)/(B0+kx*B1+kx*kx))}
TEXT 2064 2232 Left 2 !.param g2blt {(X0 + kx)/(Y0 + kx)}\n.param gdsp2 {gvo*g2blt}\n.param X0blt {(X0 - kx)/(X0 + kx)}\n.param Y0blt {(Y0 - kx)/(Y0 + kx)}
TEXT 208 1672 Left 2 ;vovxblt = gdsp2*(X0blt*z1 + 1)./(Y0blt*z1 + 1);
TEXT 272 2264 Left 2 ;vxviblt = gdsp.*(A2blt*z2 + A1blt*z1 + 1) / ( B2blt*z2 + B1blt*z1 + 1)
TEXT 2056 1984 Left 2 ;IIR Coefficients and gains
TEXT 2056 1496 Left 2 ;Analog filter coefficients and gains
TEXT 2064 1320 Left 2 ;Intermediate variable substitutions in analog filter coefficient computation
TEXT 1568 1328 Left 2 ;Sampling constants
TEXT 1560 1536 Left 2 !.param kx {2*fs}
TEXT 1560 1504 Left 2 ;Bilinear Transform Constant
TEXT -72 -832 Left 2 ;// First-order high pass filter coefficients\n// H(z) = g * (1 - z^-1)/(1 - a1*z^-1)\n// Direct Form 1:\n//    h[n] = g * ( b0*x[n] -  b1*x[n-1] ) - a1*y[n-1]\n// In below implementation gain is redistributed to the numerator:\n//    h[n] = g*x[n] - g*x[n-1] - a1*y[n-1]\na1 = -expf(-w0);\ng = (1.0 - a1)*0.5;\nb0 = g;\nb1 = -g;
TEXT -88 -512 Left 2 ;// First-order low pass filter coefficients\n// H(z) = g * (1 - z^-1)/(1 - a1*z^-1)\n// Direct Form 1:\n//    h[n] = g * ( b0*x[n] - b1*x[n-1] ) - a1*y[n-1]\n// In below implementation gain is redistributed to the numerator:\n//    h[n] = gb0*x[n] - gb1*x[n-1] - a1*y[n-1]\na1 = -expf(-w0);\ng = (1.0 + a1)/1.12;\nb0 = g;\nb1 = 0.12*g; //0.12 zero improves RC filter emulation at higher freqs.
TEXT -96 -160 Left 2 !.param w1 {1/(33k*10n)}
TEXT -96 -120 Left 2 !.param w2 {1/(27k*10n)}
TEXT -32 768 Left 2 !.param a11 = -exp(-w1/fs);\n.param g1 = (1.0 - a11)*0.5;\n.param b10 = g1;\n.param b11 = -g1;
TEXT -32 520 Left 2 !.param a21 = -exp(-w2/fs);\n.param g2 = (1.0 - a21)*0.5;\n.param b20 = g2;\n.param b21 = -g2;
TEXT 2704 -2224 Left 2 !.param rgpot 100k\n.param rgser 10k
TEXT 2704 -2136 Left 2 !.param gpos 1.0\n.param igpos {1-gpos}
TEXT -104 40 Left 2 !.param gx1 {(rgser + rgpot*gpos)/33k}
TEXT -104 72 Left 2 !.param gx2 {(rgser + rgpot*gpos)/27k}
TEXT 1296 512 Left 2 ;.param a31 = -exp(-w3/fs);\n.param b30 = 1-exp(-w3/fs);;\n.param b31 = 0.0;
TEXT -96 -80 Left 2 !.param w3 {1/(110k*100p)}
TEXT -96 -32 Left 2 !.param w4 {1/((rgser+rgpot*igpos)*100n)}
TEXT 2544 544 Left 2 !.param a41 = -exp(-w4/fs);\n.param g4 = (1.0 - a41)*0.5;\n.param b40 = g4;\n.param b41 = -g4;
TEXT -104 104 Left 2 !.param gx3 {220k/(rgser + rgpot*igpos)}
TEXT 1296 712 Left 2 !.param a31 = -exp(-w3/fs);\n.param g3 = (1.0 + a31)/1.12;\n.param b30 = g3;\n.param b31 = 0.12*g3;
TEXT 1288 456 Left 2 ;1-pole, no zero simple low-pass \nfilter implementation
TEXT 1296 624 Left 2 ;Add zero to improve\nRC filter match near\nfs/2
TEXT 120 2432 Left 3 ;TONE STACK IIR FILTER IMPLEMENTATION
TEXT 216 -160 Left 2 ;R7, C5 Pole (high-pass)
TEXT 216 -120 Left 2 ;R8, C6 Pole (high-pass)
TEXT 368 40 Left 2 ;Pot/R7 gain
TEXT 368 72 Left 2 ;Pot/R8 gain
TEXT 368 104 Left 2 ;Clipping stage gain
TEXT 2976 -2224 Left 2 ;Gain pot\nMin gain resistor series to gain pot
TEXT 2976 -2136 Left 2 ;Gain pot rotation, A-leg resistance ratio (0 to 1)\nGain pot B-leg resistance ratio
TEXT 216 -80 Left 2 ;Gain pot, resistor, C4 Pole (low-pass)
TEXT -24 736 Left 2 ;R7 current
TEXT -32 488 Left 2 ;R8 current
TEXT 336 -3008 Left 2 ;=  -------------------
TEXT 416 -3032 Left 2 ;s*C5
TEXT 720 -2984 Left 2 ;Rfb = R6 + RdriveA
TEXT 1160 -3168 Left 2 ;Rfb
TEXT 1120 -3120 Left 2 ;s*Rfb*C4 + 1
TEXT 1112 -3144 Left 2 ;--------------------
TEXT 936 -3168 Left 2 ;s*C5
TEXT 896 -3120 Left 2 ;s*R7*C5 + 1
TEXT 888 -3144 Left 2 ;--------------------
TEXT 1088 -3144 Left 2 ;*
TEXT 864 -3144 Left 2 ;+
TEXT 720 -3168 Left 2 ;s*C6
TEXT 680 -3120 Left 2 ;s*R8*C6 + 1
TEXT 672 -3144 Left 2 ;--------------------
TEXT 1056 -3192 Left 2 ;\\\n |\n |\n/
TEXT 656 -3184 Left 2 ;/\n|\n|\n\\
TEXT 1288 -3144 Left 2 ;+  1
TEXT 432 -3168 Left 2 ;V(vgain_pre)\n--------------------  =\n    V(vinr)
TEXT 376 -2984 Left 2 ;s*R7*C5 + 1
TEXT 208 -3008 Left 2 ;--------------
TEXT 232 -3032 Left 2 ;I(R7)
TEXT 216 -2984 Left 2 ;V(vinr)
TEXT 352 -2704 Left 2 ;=  -------------------
TEXT 432 -2728 Left 2 ;s*C6
TEXT 392 -2680 Left 2 ;s*R8*C6 + 1
TEXT 224 -2704 Left 2 ;--------------
TEXT 248 -2728 Left 2 ;I(R8)
TEXT 232 -2680 Left 2 ;V(vinr)
TEXT 1280 -2768 Left 2 ;=  ----------------------
TEXT 1360 -2792 Left 2 ;s*C7
TEXT 1320 -2744 Left 2 ;s*Rfeed*C7 + 1
TEXT 1160 -2768 Left 2 ;------------
TEXT 1184 -2792 Left 2 ;I(R8)
TEXT 1168 -2744 Left 2 ;V(vinr)
TEXT 1120 -2968 Left 2 ;Rfeed = R9 + RdriveB
TEXT 2632 -2776 Left 2 ;Rfb
TEXT 2592 -2728 Left 2 ;s*Rfb*C4 + 1
TEXT 2584 -2752 Left 2 ;--------------------
TEXT 2408 -2776 Left 2 ;s*C5
TEXT 2368 -2728 Left 2 ;s*R7*C5 + 1
TEXT 2360 -2752 Left 2 ;--------------------
TEXT 2560 -2752 Left 2 ;*
TEXT 2336 -2752 Left 2 ;+
TEXT 2192 -2776 Left 2 ;s*C6
TEXT 2152 -2728 Left 2 ;s*R8*C6 + 1
TEXT 2144 -2752 Left 2 ;--------------------
TEXT 2528 -2800 Left 2 ;\\\n |\n |\n/
TEXT 2760 -2752 Left 2 ;+  1
TEXT 2120 -2800 Left 2 ;/\n|\n|\n\\
TEXT 2096 -2800 Left 2 ;/\n|\n|\n\\
TEXT 2808 -2800 Left 2 ;\\\n |\n |\n/
TEXT 2840 -2752 Left 2 ;*
TEXT 2904 -2776 Left 2 ;s*R10*C7
TEXT 2864 -2728 Left 2 ;s*Rfeed*C7 + 1
TEXT 2864 -2752 Left 2 ;----------------------
TEXT 1912 -2784 Left 2 ;V(vgain)\n---------------  =\n   V(vinr)
TEXT 2128 -2680 Left 2 ;1rst-order HPF
TEXT 2344 -2680 Left 2 ;1rst-order HPF
TEXT 2872 -2680 Left 2 ;1rst-order HPF
TEXT 2576 -2680 Left 2 ;1rst-order LPF
TEXT 1536 -1600 Left 3 ;TONESTACK DIGITIZED WITH BILINEAR TRANSFORMATION
TEXT 1160 -2608 Left 3 ;GAIN STAGES CAN BE DIGITIZED BY INSPECTION USING CASCADED FIRST-ORDER IIR FILTERS
TEXT -120 -1336 Left 3 ;STIMULUS
TEXT 344 -4080 Left 5 ;KING OF TONE -- FREQUENCY DOMAIN ANALYSIS
TEXT 352 -4016 Left 4 ;COMPARISON OF DIGITIZED IIR AND CONTINUOUS TIME TRANSFER FUNCTIONS
TEXT 944 -904 Left 5 ;DSP SIMULATION
TEXT 936 -824 Left 3 ;SPICE LAPLACE DIRECTIVE IN BEHAVIORAL VOLTAGE AND CURRENT SOURCES\nALLOWS DIRECT IMPLEMENTATION OF THE IIR FILTERS WHICH CAN BE \nCOMPARED DIRECTLY TO THE ANALOG PROTOTYPE CIRCUIT:\nz^-1 = e^(-sT)
TEXT 3192 -1736 Left 2 ;Pot rotation position, Tone\nPot rotation position, Boost
TEXT 2888 -2056 Left 2 ;R12
TEXT 2952 -2032 Left 2 ;Tone Pot (RtoneA, RtoneB)
TEXT 2960 -2000 Left 2 ;Boost Pot (Rboost)
TEXT 2896 -1832 Left 2 ;C8\nC9
TEXT 3160 -1856 Left 2 ;Volume pot parallel output pull-down resistor
TEXT 3016 -1888 Left 2 ;Intermediate computation value for Boost Pot
TEXT 2904 -1920 Left 2 ;R13
TEXT 3112 -1944 Left 2 ;Intermediate computation value for Tone Pot, lower leg.  Param rtone/fs to prevent 0 resistance which creates divide by zero
TEXT 3040 -1968 Left 2 ;Intermediate computation value for Tone Pot, upper leg, and series feed resistor
TEXT 2992 -1680 Left 2 ;Pot rotation position, Tone, alternate resistance leg to wiper
TEXT 216 -2296 Left 2 ;High-pass function of C3, R5 neglected because it is 16 Hz cut-off.  \nDC blocking going into the audio interface is likely similar.\nIn both cases, negligible in bands where tone of the circuit is shaped.