When playing lower notes, there are noticeable variations in the attack character of successive notes, especially sounds with a longer release. It sounds like the oscillator phase and rapid envelope decay are out of sync (with fixed phase osc). The modulation param also doesn’t take “Key On Del” into account. I’m guessing this has something to do with the execution order of the program tree.
The same thing happens with the standard Env Midi Module.
I’ve tried various ways of delaying the mod param to sync with onNote, but nothing worked. Any ideas?
Having a go at your first question I came up with this. Each note on event should trigger the modulation and also take the Key on delay into account as long as it’s set to ms. Don’t know if that helps.
defineModulation("Quick Decay", false)
modVal = 1
durationMS = 15
zone=this.parent:getZone()
function calcModulation()
rate=getSamplingRate()/32
rateVal=1/(rate*(durationMS/1000))
modVal=modVal-rateVal
if modVal<0 then
modVal=0
end
return modVal
end
function onNote(event)
postEvent(event)
wait(zone:getParameter("VoiceControl.KeyOnDelay"))
modVal=1
end