-m128
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
//both inputs for the main instrumant as p-fields
instr SendPartials
iBasePitch = p4 ;midi note number
iVolumeDb = p5 ;db
iBaseFreq mtof iBasePitch
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 = ampdb(iVolumeDb)*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 2, 5, 2
kPchRnd randi 1/10, 6, 2
aSine poscil aEnv*ampdb(aEnvRndDb), mtof(kPchRnd+ftom(iFreq))
out aSine, aSine
endin
i "SendPartials" 0 5 48 -6
100
100
320
240
true
255
255
255