-m128
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
//pitch (midi note) input for the base frequency
instr SendPartials
iBasePitch = 48 ;as MIDI note number
iBaseFreq mtof iBasePitch
;... and an array of proportions
iFreqProps[] fillarray 1, 2, 3, 4, 5
iAmps[] fillarray 0.5, 0.3, 0.2, 0.1, 0.1
index = 0
while index < lenarray(iFreqProps) do
;frequency is now basefreq times proportion
iFreq = iBaseFreq*iFreqProps[index]
iAmp = iAmps[index]
schedule "ReceivePartials", 0, p3, iAmp, iFreq
index += 1
od
endin
instr ReceivePartials
iAmp = p4
iFreq = p5
iAttackTime random 1/1000, 3/1000
aEnv transeg 0, iAttackTime, 4, iAmp, p3-iAttackTime, -4, 0
aEnvRndDb randi 1, 5, 2
kPchRnd randi 1/12, 3, 2
aSine poscil aEnv*ampdb(aEnvRndDb), mtof(kPchRnd+ftom(iFreq))
out aSine, aSine
endin
i "SendPartials" 0 5
100
100
320
240
true
255
255
255