|
From: Christian S. <chr...@ep...> - 2004-01-09 20:32:27
|
Hi everybody!
Sorry that I didn't had time to answer. I'm currently implementing EG1
(amplitude envelope generator), so no need for a quick hack, I hope to finish
it tomorrow or at least til sunday.
First the EG will be just be a simple ASR one (with Attack=lin and
Sustain=exp). Extending that later to PADSDR (as used in Gigasaampler) is
very trivial.
I will calculate the exponential curve by this simple discretisation of the
exp() function:
env = 1.0
loop {
env = env - env * release_coeff
fire_vca_event(env);
}
this will be done before the interpolate loop, within the EG class. It just
fires it's VCA events and then in the Interpolate loop I just add the delta
value of the VCA event.
The release_coeff is calculated in this way:
release_coeff = 1 - exp(ln(limit)/release_ms*samplerate*0.001)
where 'limit' is the bottom value limit of the exp curve considered to be the
end (usually the limit of the variable type), and the other two are
self-explanatory I think. This heavy function is not a problem because it
will only be calculated once when a voice will be triggered (or sustain value
changed by some controller, etc.).
I'm not sure already, but at the moment I'm more tending to queue and process
events sample accurate not only in a certain amount of steps (32 was proposed
by Steve I think). My idea is to use two different Interpolate loops; one
which processes events and one that is executed when there are no events
queued for the current time stage. This will switch respectively.
Any doubts?
CU
Christian
|