; coded by Oeyvind Brandtsegg 2002, revised 2002
; simple synth with two oscillators and one filter
; envelope control of filter cutoff and drive
; The rounded saw wave is used to try to fatten the sound,
; and to make it appear louder (more energy in the wave).
; The lpf18 filter also contributes to the roundness of the sound.
;CsoundAV command line, edit to suit your platform and choice of Csound version
-+X -+K -b2048
;enable midi in and audio out
sr = 44100
kr = 441
ksmps = 100
nchnls = 2
instr 1
inum notnum
icps cpsmidi
icps = icps * 0.5
iamp ampmidi 14000
; envelope setup **************************************
a_amp linenr iamp, 0, .3, .01
kenv linsegr 0, 0.02, 1, 0.6, 0.5, 1.0, 0.8, 0.3, 0 ; parameter control envelope
kfilt = (kenv * 400) + 20 ; filter envelope scaling + offset
kdist = (kenv * 0.6) + 0.4 ; dist envelope scailing + offset
; sound processing section **************************************
a1 oscil 1, icps, 95 ; rounded saw wave
asine oscil 1, icps, 93 ; pure sine
alo lpf18 a1, kfilt, 0.5, kdist ; filter
aout = ((alo * 0.3) + asine) * a_amp ; mixing and scaling
outs aout, aout
endin
;*********************
f93 0 65536 10 1 ;sine
f95 0 1024 7 0 4 1 196 0.9 624 -0.9 196 -1 4 0 ;saw wave, supersaw
f0 6000 ; allows realtime midi playing for n seconds
e