KVR :: DSP and Plug-in Development » RC Circuit Tutorial [View Original Topic]
There are 6 posts in this topic.
Leslie Sanford - Sun Oct 02, 2011 8:13 am
Here's a good tutorial on the ubiquitous RC Circuit:
RC Circuit Tutorial
I like the graphs showing charging curves on a timeline.
Leslie Sanford - Mon Oct 03, 2011 3:26 am
Learned something new from
this
f = 1 - exp(-1 / d) gives you the coefficient to use to get to 63.2% of the target amplitude in d number of samples. After another d number of samples have passed, the amplitude is 63.2% of the remaining amplitude. This continues forever.
So if our target is 1, i.e. y += f * (1 - y), we get the following results:
1d 0.632
2d 0.865: (1 - 0.632) * 0.632 + 0.632
3d 0.951: (1 - 0.865) * 0.632 + 0.865
4d 0.982: (1 - 0.951) * 0.632 + 0.951
5d 0.993: (1 - 0.982) * 0.632 + 0.982
We can calculate the amplitude of the curve arbitrarily by using this formula:
a = 1 - exp(-x / fs)
Where x is the position in samples and fs is the sample rate.
Say the sample rate is 44100 and we wish to calculate the curve at 22050:
a = 1 - exp(-22050 / 44100)
Which gives us:
0.3934693403
duncanparsons - Tue Oct 04, 2011 10:01 am
I oft scale my targets so that they reach the desired level exactly within the samples wanted
mystran - Tue Oct 04, 2011 10:45 am
The 1 - exp(-1 / (time*samplerate)) formula is certainly useful for a lot of things from envelope coefficients to constant-time decay of delay feedback etc.
Borogove - Tue Oct 04, 2011 12:51 pm
duncanparsons wrote:
I oft scale my targets so that they reach the desired level exactly within the samples wanted

Chamberlin describes a trick where you aim an exponential 5% beyond the desired target and stop after 3 time constants: (1-0.632)^3 = ~0.05.
CUNKA - Thu Oct 06, 2011 12:37 am
You might also enjoy this informative website also Leslie.
http://www.falstad.com/circuit/e-index.html#sawtooth
There are 6 posts in this topic.