<info>
Vocoder module with special controls
Adjusts automatically for mono or stereo files.
c, Jean Piche, 1997-1998

exciter		=	file on which analysis is performed.
carrier		=	file which is filtered by the analysis.

no_of_filters	=	number of bandpass filters in the vocoder.

baseFreq	=	lowest filter frequency.

expansion	=	the multiplier for the power series to determine the frequency
			of successive filters:      f(n) = f(n-1)*expansion.

resonance	=	bandwidth of each band:   f(n) * resonance.

port		=	smoothing time for amplitude envelope of each band 

outgain		=	amplitude multiplier for output stage.
</info>
<tk_interface>
cgraph	basefreq  		-label "Base\nFrequency" -uni Hz -rel lo -min 20 -max 3000 -init 50 
csepar
cgraph	expansion  		-label "Expansion\nFactor" -uni x -rel li  -min 1 -max 2 -init 1.85 
csepar
cgraph	outgain		-label Gain -uni x -min  0.1 -max 4 -init 1.0 
csepar
cgraph	resonance		-label Resonance -uni x -rel lo -min .0001 -max .5 -init .01 
cslider	no_of_filters 		-ra i  -label "Number of filters" -uni "" -res 1 -min 2 -max 24 -init 8
cslider	port		-ra k  -label Potamento -uni sec. -res  .001 -min 0 -max 1 -init .1
cslider	total_time		-label Time -max 300 -min 0 -init 30 -uni sec.
cpopup	lev 		-label "Gain Balance" -value "Exciter Carrier" -init 0
ctoggle	loop 		-label "Loop Input Files" -init 1
cfilein	exciter 		-label "Exciter file"
cfilein	carrier 		-label "Carrier file"
</tk_interface>
<mono>

</mono>
<stereo>
gabol init 0
gabol2 init 0

;----------------------------------------------------------



	instr 96
iloop 	= 	i(gkloop)
	gain1		diskin	"[exciter]", [sinfo exciter sr]/sr, [offexciter], iloop
	gain2 	= 	gain1
	endin

	instr 97
iloop 	= 	i(gkloop)
	gain1, gain2		diskin	"[exciter]", [sinfo exciter sr]/sr, [offexciter], iloop
	endin

	instr 98
iloop 	= 	i(gkloop)
	gain3		diskin	"[carrier]", [sinfo carrier sr]/sr, [offcarrier], iloop
	gain4 	= 	gain3
	endin

	instr 99
iloop 	= 	i(gkloop)
	gain3, gain4		diskin	"[carrier]", [sinfo carrier sr]/sr, [offcarrier], iloop
	endin






;----------------------------------------------------------

													instr 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20


ifact	ipow	i(gkexpansion), p1-1 
kpit	init	i(gkbasefreq) * ifact
kpit2	init	i(gkbasefreq) * ifact

ares1	butterbp	gain1, kpit, kpit*gkresonance
klev1	rms	ares1  
kfact	kpow	gkexpansion, (p1-1), 1 
kpita	=	gkbasefreq * kfact
kpit	kport	kpita, .005
klev1	kport 	klev1, gkport
aros1	butterbp	gain3, kpit, kpit*gkresonance
abal1	gain	aros1, klev1

;	-------------------------------------------

ares2	butterbp	gain2, kpit, kpit*gkresonance
klev2	rms	ares2  
kfact	kpow	gkexpansion, (p1-1), 1 
kpitb	=	gkbasefreq * kfact
kpit2	kport	kpitb, .005
klev2 	kport 	klev2, gkport
aros2	butterbp	gain4, kpit2, kpit2*gkresonance
abal2	gain	aros2, klev2

nope:
gabol	=	gabol + (abal1)
gabol2	=	gabol2 + (abal2)

												endin

;----------------------------------------------------------


													instr 78
klev	 = 	gklev
about	balance	gabol, gain1	
abouf	balance	gabol2, gain2
about2	balance	gabol, gain3	
abouf2	balance	gabol2, gain4

if klev == 0 goto excit

goto outer

excit:
outs about*gkoutgain, abouf*gkoutgain

outer:
outs about2*gkoutgain, abouf2*gkoutgain
	gabol = 0
	gabol2 = 0
												endin
</stereo>
<quad>

</quad>
<score>
#tcl
proc makeScore {} {
	global  value realArr soundInInfo
	set du $value(total_time)
	append thescore "f1  0 8192 10 1\n"
          if {[sinfo exciter chn] == "1"} {append thescore "i96  0 $du\n"}  {append thescore "i97  0 $du\n"}
	if {[sinfo carrier chn] == "1"} {append thescore "i98  0 $du\n"}  {append thescore "i99  0 $du\n"}
	append thescore "i78  0 $du\n"
		for {set num 1} {$num <= $value(no_of_filters)} {incr num 1} {
		   append thescore "i$num 0 $du \n"
		}
	return $thescore
}

makeScore
</score>
