|
From: Benno S. <be...@ga...> - 2002-11-15 13:04:09
|
On Fri, 2002-11-15 at 13:31, Steve Harris wrote:
>
> I dont understand the question, the envelope shape is dynamic depending on
> the length of the appropriate section (attack, decay, etc). The only thing
> that needsa to be selected is the fudge factor (4.0 ish IIRC) which
> determines epsilon for the envelope.
Ok.
>
> Well, the code for this is created on demand right? (a JIT sampler ;)
> So if there is no envelope there is no envelope code. If there is an
> envelope, then when we have reached epsilon, the envelope has (in theory)
> come to an end, we can fade to 0.0 to make sure, and then the voice has
> finished.
But I meant a voice that can be dyncamically enveloped at runtime where
the voice sucks up less CPU when no enveloping is active.
>
> BTW do we know for sure than samplers use exponential envelopes? I guess we
> need linear ones too, but they are easy to implement. We should probably
> get some recordings from samples of high freq sinewaves with envelopes.
> I think Frank N. has done this allready for the S2000, Frank are you on
> the list?
Since I'm a bit CPU-power paranoid at this design stage, I thought it it
really make sense to use the exponentials.
I mean: why not use only linear envelopes and "emulate" exponentials
with a few linear segments.
The big advantage of linear that it costs us only one addidional
addition whiche your exponential code is more expensive.
with linear envelopes we have:
while(1) {
output_sample(pos);
sample_pos += pitch;
pitch += pitch_delta;
volume += volume_delta;
}
These two _delta additions add very little to the total CPU cost but
provide us with good flexibility.
When no pitch/volume enveloping is occurring, simply set
pitch_delta and volume_delta to 0
When applying modulation generate events that set the *_delta variables
in appropriate intervals.
Assume we want to emulate exponentials: generate events at let's say 1/8
samplingrate and I think it is probably impossible to distinguish the
approximation from the exact curve. (we are talking of relatively "slow"
volume and pitch modulation).
For example assume we process MIDI pitch bend events with the linear
interpolator.
It is probably the easiest to keep track of the previous pitch value
and then simply interpolate linearly to the new value within a let's say
0.5 - 1 msec time frame. I think this would smooth out things nicely,
right ?
(Steve, others, do you agree ?)
>
> Yes. Though you can get away without it if you know the cutoff isn;t
> chaging too rapidly (eg. a slow LFO).
Ok but assume these nice LP filter wah-wah effects.
The LFO frequency in this case is up to a few Hz, but the modulation
frequency (filter coefficient change rate) ? How low can it go so that
zipper noise can be avoided ?
>
> > What would a good tradeoff for achieving low-CPU usage zippernoise-free
> > filter modulation would be ? (some kind of interpolation of precomputed
> > coefficients ?)
>
> I think so. Not all filters like you doing this, but most are OK IIRC.
> I have some SVF and biquad test code around, so I can test this if you
> like. I think my LADSPA SVF uses linear interp. to smooth the coefficients.
ok let us know.
Benno.
--
http://linuxsampler.sourceforge.net
Building a professional grade software sampler for Linux.
Please help us designing and developing it.
|