; fmscape.orc
; instr 1 is a simple modulator oscillator to be multiply instantiated
; instr 2 mixes the modulators and frequency modulates a shared carrier
; Anthony Kozar
; April 5, 2005
; On the web at
; Email
; I am placing this Csound orchestra file in the
; public domain. I therefore waive all copyright
; interest in it.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
giSine ftgen 0, 0, 16385, 10, 1 ; sine wave table
gaFMmod init 0 ; combined modulator signals
gaModEnv init 0 ; combined modulator envelopes
; modulator instrument
; multiple instances of instr 1 will be added together
instr 1
idur = p3
iamp = ampdb(p4) ; unnecessary ?
ifreq = cpspch(p5)
iampbeg = p6 ; percent amplitude at note beginning
iampend = p7 ; precent amplitude at note end
iattack = p8 ; amp env attack time
irelease = p9 ; amp env release time
; note amplitude
isustain = idur - iattack - irelease
aampline line iampbeg, idur, iampend
aenv linseg 0.0, iattack, 1.0, isustain, 1.0, irelease, 0.0
aamp = aampline * aenv
; create sound
aosc poscil aamp, ifreq, giSine
; and accumulate results
vincr gaFMmod, aosc
maxaccum gaModEnv, aamp
; if (aamp > gaModEnv) then
; gaModEnv = aamp
; endif
endin
; carrier instument
; designed for singelton use; processes the sum of all modulator instances
; uses the maximum of the modulator envelopes so that it only sounds when
; there is at least one active modulator
instr 2
idur = p3
iamp = ampdb(p4)
ifreq = cpspch(p5)
imodidx = p6
ileftdel = p7 ; left channel delay time
irightdel = p8 ; right channel delay time
irevbtime = p9 ; reverberation time
; generate carrier signal
imodamt = imodidx * ifreq / 16 ; 16 for four octaves?
acarr poscil gaModEnv, ifreq + (imodamt * gaFMmod), giSine
; add some spatial depth
adelayL delay acarr, ileftdel
adelayR delay acarr, irightdel
areverbL reverb .5*(adelayL+acarr), irevbtime
areverbR reverb .5*(adelayR+acarr), irevbtime
outs iamp*areverbL, iamp*areverbR
;;; outs iamp*acarr, iamp*acarr
; clear out globals
clear gaFMmod, gaModEnv
endin