|
From: <be...@ga...> - 2003-12-30 15:36:22
|
Scrive ian esten <de...@cu...>:
> > For performance reasons I'd opt for a system that uses only linear
> > segments for both volume and pitch enveloping.
> > exp curves and other kind of envelopes can be easily simulated by
> > using a serie of linear segments.
>
> i think you would probably find this to be more expensive than having
> log/exp curves. to create the traditional log style envelopes is
> actually very easy, and can be done with a modified one pole (no zero)
> lowpass filter. that just requires one coefficient calculation for the
> whole curve, rather than doing a whole load of calculations for each
> linear segment.
>
Expensive ? I don't think so:
let's make this example:
with linear envelopes (let's assume we allow volume and pitch envelopes)
for(i=0; i < numoutput_samples; i++) {
output_sample[i] = curr_volume * sample[curr_pitch];
curr_volume += volume_delta;
curr_pitch += pitch_delta;
}
As you see with only two additions:
curr_volume += volume_delta;
curr_pitch += pitch_delta;
you get arbitrary volume and pitch envelopes.
if you keep the value to zero then there is no envelope.
Otherwise just update
volume_delta and/or pitch_delta from time to time
(event based).
The system is so fast that you could even update the delta values
eg every 4 samples allowing for arbitrary curves without significant overhead.
But in pratice even exponential curves can be emulated using relatively
few linear segments (in the fast changing sections you can use more points).
Am I missing something ?
Ian can you post a small code example (like I did) to show me how
many instruction the main sample rendering loop contains, and if we
can achieve the same as in my case above (arbitrary modulation)
cheers,
Benno
http://www.linuxsampler.org
-------------------------------------------------
This mail sent through http://www.gardena.net
|