Additive Synthesis Example
Additive Synthesis Example
; ADDREV.ORC - Additive Synthesis and Reverberation
; ...some lowpass filtering is also used here...
; By: RST and CUS - MUS499 Seminar
; Initializaton Block - SRATE etc.
sr = 20000
kr = 1000
ksmps = 20
nchnls = 2
; Initialize global variable for reverb send!
garvbsig init 0
; Six OCSILI units are used
instr 1
iamp = p4
ifund = p5
ifilt = p6
irvb = p7
irand = 22.0 ; pitch deviation
irtime = 7 ; random time element
; General Envelope for Additive Snd.
aenv linseg 0,p3/2,1,p3/2,0
; Randomizer for random rates below.
aptim randi irtime, .01
; Random pitch offset according to randomized time.
; Each OSCILI UG eventually added.
ap1 randi irand, 2*aptim
asig1 oscili iamp/6, ifund*1.00+ap1, 1
ap2 randi 1rand, 3*aptim
asig2 oscili iamp/6, ifund*1.4+ap2, 1
ap3 randi 1rand, 4*aptim
asig3 oscili iamp/6, ifund*1.7+ap3, 1
ap4 randi 1rand, 5*aptim
asig4 oscili iamp/6, ifund*1.9+ap4, 1
ap5 randi 1rand, 6*aptim
asig5 oscili iamp/6, ifund*2.18+ap5, 1
ap6 randi 1rand, 7*aptim
asig6 oscili iamp/6, ifund*2.39+ap6, 1
; MIX SIGNAL
; APPLY ENVELOPE
amixed = asig1+asig2+asig3+asig4+asig5+asig6
aenved = amixed*aenv
; Low Pass filter to cut high freq harshness.
asigf butterlp aenved, ifilt
; Reverb Send Signal
garvbsig = asigf*irvb
; MIX for MONO OUTPUT!
outs asigf, asigf
endin
;******************************************************************************
; Reverberation Instrument - two parallel reverbs with tone controls on
; the output of each!
;******************************************************************************
instr 100
idur = p3
irvbtime1 = p4
irev1amp = p5
irev1low = p6
irev1hi = p7
irvbtime2 = p8
irev2amp = p9
irev2low = p10
irev2hi = p11
; Reverb Section
arev1 reverb2 garvbsig*irev1amp, irvbtime1, .1
arev2 reverb2 garvbsig*irev2amp, irvbtime2, .1
; Post Reverb Tone Controls REV1
arev1lp butterlp arev1, irev1low
arev1hp butterhp arev1lp, irev1hi
; Post Reverb Tone Controls REV2
arev2lp butterlp arev2, irev2low
arev2hp butterhp arev2lp, irev2hi
; MIX for MONO OUTPUT
asig = arev1hp+arev2hp
outs asig, asig
garvbsig = 0
endin
;*******************************************************************************
; AND NOW THE SCORE FILE
;*******************************************************************************
; addrev.sco
; oscili table
f1 0 2048 10 1
; reverb
; time amp lo hi time amp lo hi
i100 0 50 2.3 2.0 1000 20 13.2 2.0 8000 1200
;
i1 0 10 2000 116 6990 .6
i1 6 10 2000 398 6990 .6
i1 14 10 2000 668 6990 .6