The Csound Blog By Jacob Joaquin http://csound.noisepages.com/ jacobjoaquin@gmail.com sr = 44100 kr = 4410 ksmps = 10 nchnls = 2 0dbfs = 1.0 # define DeepSynth # 1 # # define SynthEngine # 2 # seed 0 ; Different every time instr $DeepSynth idur = p3 ; Duration iamp = p4 ; Amplitude ipch = cpspch(p5) ; Pitch iattack = p6 ; Amplitude attack idecay = p7 ; Amplitude decay irange = p8 ; Bi-polar range of frequency deviation, in half-steps icps_min = p9 ; Min rate of jitter deviation icps_max = p10 ; Max rate of jitter deviation ifn = p11 ; Index of wavetable for oscillator ivoices = p12 ; Number of voices ; Rescale amplitude based on number of voices iamp = iamp / ivoices ; Create Synth Events i_index = 0 loop_start: ; Evenly disperse voices in stereo field if ivoices > 1 then ipan = i_index / (ivoices - 1) else ipan = 0.5 endif ; Generate event event_i "i", $SynthEngine, 0, idur, iamp, ipch, iattack, idecay, ipan,\ irange, icps_min, icps_max, ifn loop_lt i_index, 1, ivoices, loop_start endin instr $SynthEngine idur = p3 ; Duration iamp = p4 ; Amplitude ifreq = p5 ; Frequency iattack = p6 ; Amplitude attack idecay = p7 ; Amplitude decay ipan = p8 ; Pan position irange = p9 ; Bi-polar range of frequency deviation, in half-steps icps_min = p10 ; Min rate of jitter deviation icps_max = p11 ; Max rate of jitter deviation ifn = p12 ; Index of wavetable for oscillator idb144 = 10 ^ (-144 / 20) * 0dbfs ; Start envelope at -144db krand jitter irange, icps_min, icps_max ; Random envelope segments kfreq = 2 ^ (krand / 12) * ifreq ; Convert to half-steps ; Envelope and oscillator aenv expseg idb144, iattack, iamp, idur - (iattack + idecay), iamp, idecay,\ idb144 a1 oscil3 aenv, kfreq, ifn ; Pan coefficients ipanleft = sqrt(1 - ipan) ipanright = sqrt(ipan) ; Audio out out a1 * ipanleft, a1 * ipanright endin # define DeepSynth # 1 # # define SynthEngine # 2 # f 1 0 [2 ^ 16] 10 1 [1 / 2] [1 / 3] [1 / 4] [1 / 5] f 2 0 [2 ^ 16] 10 1 [-1 / 2] [1 / 3] [-1 / 4] f 3 0 [2 ^ 16] 10 1 0 [1 / 3] 0 [1 / 5] i $DeepSynth 0 60 1.1 8.07 6 5 1.618 0.01 1 1 15 i $DeepSynth 0 32 0.78 6.07 2 2 0.8 0.1 0.2 2 5 i $DeepSynth 26 38 0.78 6.00 4 4 0.8 0.1 0.2 2 5 i $DeepSynth 42 14 0.3 9.03 9 1 2 0.01 8 3 21