;
; "Drift Study III"
; by Dave Seidel
;
; Copyright (c) 2011 Dave Seidel, some rights reserved.  This work is licensed under a Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0/).
;
; Generated by blue 2.1.8 (http://blue.kunstmusik.com)
;

<CsoundSynthesizer>

<CsInstruments>
sr=96000
ksmps=1
nchnls=2

0dbfs = 1

giTblSz	init	1048576

; sine wave
giFn1	ftgen	 1, 0, giTblSz, 10, 1

; "Fibonacci" wave (Mt. Meru A) + 7
giFn2	ftgen	 2, 0, giTblSz, 9,  1,1,0,   2,.5,0,   3,.3333,0,  5,.2,0,  7,.143,0,   8,.125,0,  13,.0769,0,  21,.0476,0,  34,.0294,0,  55,.0182,0,  89,.0112,0  144,.0069,0

; prime wave
giPrime	ftgen	 3, 0, giTblSz, 9,  1,1,0,   2,.5,0,   3,.3333,0,  5,.2,0,  7,.143,0,  11,.0909,0,  13,.077,0,   17,.0588,0,  19,.0526,0,  23,.0435,0,  27,.037,0

ga_bluemix_1_0	init	0
ga_bluemix_1_1	init	0
ga_bluesub_Master_0	init	0
ga_bluesub_Master_1	init	0


gk_blue_auto0 init 0
gk_blue_auto1 init 8000
gk_blue_auto2 init 0.8939263821
gk_blue_auto3 init 0.6600303054
gk_blue_auto4 init 0




	opcode pan_equal_power,aa,ak

ain, kpan	xin
kangl		= 	1.57079633 * (kpan + 0.5)
		xout	ain*sin(kangl), ain*cos(kangl)


	endop
	opcode blueEffect0,aa,aa

ain1,ain2	xin
aout1, aout2  reverbsc ain1, ain2, gk_blue_auto2, gk_blue_auto1, sr, 0.5

aout1 = (ain1 * gk_blue_auto3) + (aout1 * (1 - gk_blue_auto3))
aout2 = (ain2 * gk_blue_auto3) + (aout2 * (1 - gk_blue_auto3))


xout	aout1,aout2


	endop


	instr 1	;untitled
idur	=	p3
ipch 	=	p4
iamp	=	ampdb(p5)/2
ipan	=	p6
imax	=	abs(ipch - p7)
itab	=	p8
irise	=	p9
ifall	=	p10

kenv	linen	iamp, irise, idur, ifall
asig	poscil3	kenv, ipch, itab

imin	=	0.001
kres1	expseg	imin, idur*0.03, imin, idur*0.42, imax, idur*0.09, imax, idur*0.42, imin, idur*0.04, imin
kres2	expseg	imax, idur*0.03, imax, idur*0.42, imin, idur*0.09, imin, idur*0.42, imax, idur*0.04, imax
kiofs	init	imax-imin

fsig	pvsanal	asig, 1024, 256, 1024, 1
fsig2	pvshift	fsig, kres1, ipch*2, 0
fsig3	pvshift	fsig, kres2-kiofs, ipch*2, 0
aout1	pvsynth	fsig2
aout2	pvsynth	fsig3

aLeft, aRight	pan_equal_power aout1+aout2, ipan
ga_bluemix_1_0 = ga_bluemix_1_0 +  aLeft
ga_bluemix_1_1 = ga_bluemix_1_1 +  aRight

	endin

	instr 2	;Blue Mixer Instrument
ktempdb = ampdb(gk_blue_auto0)
ga_bluemix_1_0 = ga_bluemix_1_0 * ktempdb
ga_bluemix_1_1 = ga_bluemix_1_1 * ktempdb
ga_bluesub_Master_0	sum	ga_bluesub_Master_0, ga_bluemix_1_0
ga_bluesub_Master_1	sum	ga_bluesub_Master_1, ga_bluemix_1_1
ga_bluesub_Master_0, ga_bluesub_Master_1	blueEffect0	ga_bluesub_Master_0, ga_bluesub_Master_1
ktempdb = ampdb(gk_blue_auto4)
ga_bluesub_Master_0 = ga_bluesub_Master_0 * ktempdb
ga_bluesub_Master_1 = ga_bluesub_Master_1 * ktempdb
outc ga_bluesub_Master_0, ga_bluesub_Master_1
ga_bluemix_1_0 = 0
ga_bluemix_1_1 = 0
ga_bluesub_Master_0 = 0
ga_bluesub_Master_1 = 0

	endin


</CsInstruments>

<CsScore>








i1	0.0	420	180.0	-11	-0.5	1.05	3	2	3
i1	0.0	420	240	-11	-0.25	1.05	3	2	3
i1	0.0	420	320.0	-11	0.0	1.05	3	2	3
i1	0.0	420	420.0	-11	0.25	1.05	3	2	3
i1	0.0	420	135.0	-11	0.5	1.05	3	2	3
i2	0	423	
e

</CsScore>

</CsoundSynthesizer>