<CsoundSynthesizer>

/*
 * mini_lavie.csd
 * 11-April-2008
 * Bruce H. McCosar
 *
 * This is the bass line to "La vie sous la mer (or, the Mermaid Wife)",
 * the second song on my third Jamendo album.  The instrument sound I
 * was shooting for was midway between a fretless bass and the 32'
 * bombarde on a pipe organ.
 *
 * The notes are a snippet from a longer MIDI file, transformed into
 * a score file by midi2sco:
 *
 *     http://jwgibbs.cchem.berkeley.edu/pete/midi2sco/
 * 
 * This is part of a longer piece, so I'm calling the series
 * 'mini-lavie' until I get all the instruments designed.
 * I still need the other manuals (I, II, and III).  I'll post
 * the intermediate files as I learn more.
 * 
 * If you'd like to hear the original song (live instruments,
 * not Csound), you can find my albums at:
 *
 *     http://www.jamendo.com/en/artist/bruce.h.mccosar
 */

<CsOptions>
-d -W -o test.wav 
</CsOptions>
 
<CsInstruments>

; ------------------------------------------------------------ HEADER
sr	=	44100
kr	=	4410
ksmps	=	10
nchnls	=	2

; ------------------------------------------------------- INSTRUMENTS


garvL	init	0
garvR	init	0


;	opcodes
;	|     |
	instr	100 ; ==================> WaveTerrain Pedal Bass
; . . . . . . . . . . . . . . . . . . . . . . . . . . . controls
icps	=	cpsmidinn(p4)/2 ; generate as 1 octave lower
ivel	=	p5
irsend	=	0.08 		; reverb send
; . . . . . . . . . . . . . . . . . . . . control interpretation
iamp	=	ivel*400
; the higher the velocity, the narrower the initial x radius
iradx	=	1 - 0.5*p5/88  ; starting rx
kradx	line	iradx, p3, 0.5 ; sweeps to a circle
; the higher the velocity, the further displaced
; along the line y = (5/4)x
idy	=	0.5 + 1.5*p5/88/4
idx	=	0.5 + 1.5*p5/88/5
kctrx	line	idx, 1.54, 0.5 ; sweeps back to center
kctry	line	idy, 1.54, 0.5 ; sweeps back to center
; . . . . . . . . . . . . . . . . . . . . . . . . . . . . signal
;		(variables renamed to more standard forms)
;		Stereo tracks take slightly different paths
;		through the wave terrain
;	wterrain kamp, kcps, kctrx, kctry, kradx, krady, kfnx, kfny
aL	wterrain iamp, icps, kctrx, kctry+0.04, kradx, 0.5, 1, 2
aR	wterrain iamp, icps, kctrx+0.04, kctry, kradx, 0.5, 1, 2
;	dcblock	ain [, igain=0.99]
aL	dcblock	aL
aR	dcblock aR
; . . . . . . . . . . . . . . . . . . . . . . . . . .  envelopes
;	adsr	iatt, idec, islev, irel
aenv	adsr	0.10*p3, 0.05*p3, 0.90, 0.05*p3
; . . . . . . . . . . . . . . . . . . . . . . . . . . . . output
;	dcblock	ain [, igain=0.99]
aL	dcblock	aL
aR	dcblock aR
	outs	aL*aenv, aR*aenv
; . . . . . . . . . . . . . . . . . . . . . . . . . . .  fx send
garvL	=	garvL + aL*0.08
garvR	=	garvR + aL*0.08
	endin


	instr 200 ; ======================> Global Stereo Reverb
; . . . . . . . . . . . . . . . . . . . . . . . . . . . controls
irtime	=	p4
; . . . . . . . . . . . . . . . . . . . . . . . . . . . . signal
;	nreverb asig, ktime, khdif
aL	nreverb garvL, irtime, 1
aR	nreverb garvR, irtime, 1
; . . . . . . . . . . . . . . . . . . . . . . . . . . . . output
	outs	aL, aR
; . . . . . . . . . . . . . . . . . . . . . . . . . . . .  reset
garvL	=	0
garvR	=	0
	endin

</CsInstruments>

<CsScore>

; ---------------------------------------------------------- F-TABLES

; f1 = standard sine wave (fundamental)
; #	time    size	gen	str series..
f 1	0	32768	10	1

; f2 =  experimental wave (2D modulator)
; #	time    size	gen	nh	lh	r
f 2	0	32768	11	4	1	0.3

; ------------------------------------------------------------- SCORE

; = Reverb Channel
; p1	p2	p3	p4
; inst	time	dur	rtime
;i 200	0	15	1.54

; ====================================================> Bass (P)
; p1	p2	p3	p4	p5
; inst	time	dur	note	vel
i 100	0.679	0.536	46	51
i 100	1.214	0.357	53	60
i 100	1.571	0.179	46	59
i 100	1.750	0.536	53	69
i 100	2.286	1.071	46	51
i 100	3.357	0.536	44	61
i 100	3.893	0.357	51	60
i 100	4.250	0.179	44	53
i 100	4.429	0.536	51	63
i 100	4.964	1.071	44	59
i 100	6.036	0.536	42	53
i 100	6.571	0.357	49	57
i 100	6.929	0.179	42	47
i 100	7.107	0.536	49	72
i 100	7.643	1.071	42	53
i 100	8.714	0.536	44	53
i 100	9.250	0.357	51	47
i 100	9.607	0.179	44	32
i 100	9.786	0.536	51	73
i 100	10.321	1.071	44	52

</CsScore>
 
</CsoundSynthesizer>
