#define USRLIBS TDFLIB
#include <SEP.defs>
#define FIGLIST dleak dbutter dallpass dgauss
#define FIGLIST dleak dbutter
#define PATH Tleak Scale Noise

default&: tube

#define ALLPASS Allpass.x ncon=1 rho=.6
$----------------------------------------------------------------
FIGDIR/dleak.v !: leak1.v leak3.v leak5.v
	vp_SideBySideIso leak1.v leak3.v leak5.v > FIGDIR/dleak.v

leaksyn.H: cakehelp Pow.x
	Spike n1=200 n2=4  | Noise var=1 gauss=1 rep=1 		> noise.H
	<noise.H Pow.x pow=7 | Scale dscale=1 			> sparse.H
	<sparse.H Tleak    | Scale dscale=1 			> leaksyn.H

#define WIGGLE Wiggle pclip=100 fastplot=20
leak%.v :	leaksyn.H Interleave.x Pef1.x
	Zero filt.H padin.H
	<leaksyn.H Pef1.x nf=10 j2=1 gapn=% padin=padin.H > iner.H
	< iner.H Interleave.x other=padin.H >inter.H
	<inter.H WIGGLE zplot=.7 > junk.V out=leak%.v

$----------------------------------------------------------------
FIGDIR/dbutter.v !: but.1.H but.4.H but.8.H but.12.H
	Merge axis=2 space=n <but.12.H but.8.H but.4.H but.1.H padin.H > merge.H
	<merge.H WIGGLE zplot=.45 > dbutter.V  out=FIGDIR/dbutter.v

#define BUTTER Butterworth cutoff=.4 ncoef=5 hilo=1.| Butterworth cutoff=.1 ncoef=5 hilo=-1. | Scale dscale=1
buttersyn.H: cakehelp Pow.x
	Spike n1=75 n2=1 k1=15 >noise.H
	<noise.H Pow.x pow=7 | Scale dscale=1 > sparse.H
	<sparse.H BUTTER > buttersyn.H

but.%.H : buttersyn.H Pef1.x
	Zero padin.H
	<buttersyn.H Pef1.x nf=30 j2=1 gapn=% padin=padin.H >but.%.H

$----------------------------------------------------------------
FIGDIR/dallpass.v !: cakehelp Allpass.x Interleave.x Pow.x Pef1.x
	Spike n1=200 n2=4 | Noise var=1 gauss=1 rep=1 > noise.H
	<noise.H Pow.x pow=5 | Scale dscale=1 > sparse.H
	<sparse.H  ALLPASS | Scale dscale=1 > allsyn.H
	Zero padin.H
	<allsyn.H Pef1.x j2=1 nf=20 lag=15 gap1=15 gapn=15 nonuniform=1 nstage=3 padin=padin.H > iner.H
	<iner.H Interleave.x other=padin.H > inter.H
	<inter.H WIGGLE zplot=.65 > dallpass.V out=FIGDIR/dallpass.v

$----------------------------------------------------------------
#define POW 1 2 3 4 5 6
FIGDIR/dgauss.v !: [[sub X dX.H POW]]
	Cat s1.H d1.H s2.H d2.H s3.H d3.H s4.H d4.H s5.H d5.H s6.H d6.H >cat.H
	<cat.H Window |Reverse axis=2 >dgauss.H
	<dgauss.H WIGGLE zplot=.75 > dgauss.V out=FIGDIR/dgauss.v

d%.H s%.H:  cakehelp Allpass.x Pow.x Pef1.x
	Spike n1=300| Noise var=1 gauss=1 rep=1|Pow.x pow=% |Scale dscale=1| ALLPASS | Scale dscale=1 > syn.H
	Zero padin.H
	<syn.H Pef1.x j2=1 nf=20 lag=15 gap1=15 gapn=15 nonuniform=1 nstage=3 padin=s%.H > d%.H

clean&: jclean

#include<SEP.idoc.rules>
#include<SEP.prog.rules>
#include<SEP.obj.rules>
