sr	=	44100
	kr	=	4410
	ksmps	=	10
	nchnls	=	1

;==================================================================
;Simple cross synthesis instrument using pvbufread and pvcross. 
;Notes:
;	- pvcross requires a preceding pvbufread to work
;	- pvbufread reads the analysis data from one pvanal 
;	  output file. The output is buffered for use by 
;	  subsequent pvcross or pvinterp units in the same instr.
;	- pvcross reads the analysis data from a second pvanal
;	  output file and then resynthesizes it using a combination
;	  of the amplitude data in its own pvanal file and the one
;	  being read by pvbufread, according to the two kamp args.
;	- To produce a amp data crossfade from file1 to file2,
;	  make kamp1 and kamp2 be 1 and 0, respectively.
;	- To produce a pure "cross synthesis," make the values for
;	  both kamp1 and kamp2 be 0. This will cause pvcross to use
;	  the amp data from file1 only, and the freq data from file2.
; RP
;===================================================================

	instr	2
idur	=	p3
ipvfn1	=	p4
ilen1	=	p5
ipvfn2	=	p6
ilen2	=	p7
iamp1	=	p8
iamp2	=	p9
ifmod	=	p10		;max pitch change in semitones
ifmfn	=	(p11 == 0 ? 1 : p11) ;default to a valid fn#

; Independent timptrs for pvbufread and pvcross
ktime1  line    0, idur, ilen1
ktime2  line    0, idur, ilen2
; Allows a crossfade between the two analysis files for amp control 
kcross	line	iamp1, idur, iamp2    
; Frequency modification control function
kfctrl	oscil1i	0,ifmod,p3,ifmfn
kfmod	=	exp(kfctrl/12*log(2))
	pvbufread       ktime1, ipvfn1
apv     pvcross ktime2, kfmod, ipvfn2, 1-kcross, kcross
apv	linen	apv,.1,p3,.2	;overall envelope
	out	apv
	endin	


f01	0	513	7	0	513	1
f02	0	513	7	1	513	0
f03	0	513	1	"pvoctest.fun"	0	4	0
;
;Cross synthesis with pvoc.904 and pvoc.905 (eroi.wav)
;Both use frame size 1024 and overlap 8.
;nn	st	dur	pvfn1	len1	pvfn2	len2	amp1	amp2	ifmod	ifmfn
i2	0	3.646	904	1.67	905	3.646	0	1	0	0
i2	4	.	.	.	.	.	1	0
i2	8	3.646	905	3.646	904	1.67	0	1
i2	12	.	.	.	.	.	1	0
f0	16.0
s
;Cross synthesis with pvoc.904 and pvoc.906 (wavest44.wav)
;Both use frame size 1024 and overlap 8.
;nn	st	dur	pvfn1	len1	pvfn2	len2	amp1	amp2	ifmod	ifmfn
i2	0	8	904	1.67	906	16.81	0	1	0	0
i2	8	8	904	1.67	906	16.81	.5	.5
i2	16	.	.	.	.	.	1	0
f0	26
s
;Same 2 pvoc files, now with freq mod control function
f04	0	513	7	0	128	1	256	-1	129	0
;
;nn	st	dur	pvfn1	len1	pvfn2	len2	amp1	amp2	ifmod	ifmfn
i2	0	8	904	1.67	906	16.81	.5	.5	3	4
e


Download pvoc2.orc

Download pvfiles2.zip

Download pvoc2.sco