Page 1 of 1

RC Circuit Tutorial

Posted: 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.

Posted: 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:

Code: Select all
`1d    0.6322d    0.865: (1 - 0.632) * 0.632 + 0.6323d    0.951: (1 - 0.865) * 0.632 + 0.8654d    0.982: (1 - 0.951) * 0.632 + 0.9515d    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

Posted: Tue Oct 04, 2011 10:01 am
I oft scale my targets so that they reach the desired level exactly within the samples wanted

Posted: 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.

Posted: 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.

Posted: Thu Oct 06, 2011 12:37 am
You might also enjoy this informative website also Leslie.