I'm assuming you want to exactly mimic the ADSR of an analog synth.
If so, here's how it was done.
First, think like an analog synth. That is, volts per octave. Standard was
1 volt per octave (i.e. each increase of 1 volt results in doubling
frequency).
Range of synths was 10 octaves (20 - 20000 Hz).
In ADSR, all charging, discharging was done via RC time constants. This
is exponential, NOT integration as a previous writing thought.
Synths used 15 volt power supplies.
In the attach phase, +15 was fed thru a variable resistor (determined attach
time) to a cap until voltage reached 10 volts.
So formula for attack is
vout = 15 * ( 1 - exp(t/(RA*C))
where t is time, RA is attack resistance and C is capacitance.
When vout reached 10, the attack circuit was switched off, and the decay
circuit was switched in. The decay circuit discharged the cap to ground (0)
through the decay
resistor. So the output voltage at time t (where t=0 is time decay begins)
is
vout = 10 * exp(t/(RD*C))
where RD is decay circuit resistance.
When vout decayed to sustain level, the sustain level was maintained until
gate was removed
(key release). At that time, the release circuit was switched in, which
like the decay circuit
caused the voltage to decay to zero using this formula
vout = VS * exp(t/(RR*C))
where VS is sustain voltage and RR is release resistor.
Now some comments on implementation.
1. Don't get hung up on R & C. Simply choose what the max
attach/decay/release times
are, substitute this for "t" in above and solve for combined RC.
2. The sliders (potentiometers) used where audio taper (logarithmic) (except
for sustain which was linear taper).
You have to take this into consideration to convert any user control into a
time constant. If you want
to be fanatical about it, you should purchase and measure an audio taper pot
because they are not exactly logarithmic.
3. If you want to use ADSR to control oscillator frequency, the ADSR value
causes an exponential change in frequency.
(Think volts/octave).
4. On the other hand, VCAs in synth where linear. So for controlling
volume, use scaled value of ADSR for gain control.
5. Actual exp() and log() functions should probably be done via lookup
table.
Hope this helps.
-----Original Message-----
From: owner-music-***@shoko.calarts.edu
[mailto:owner-music-***@shoko.calarts.edu]On Behalf Of Jon Watte
Sent: Friday, March 15, 2002 11:40 AM
To: music-***@shoko.calarts.edu
Subject: RE: [music-dsp] ADSR, how?
I know of two ways:
1) actually use a linear envelope
2) use a dB envelope, but make the "rise time" and "fall time" affect
integrator constants as well as timing constants.
2) would then treat the envelope as a series of filters and levels,
where the envelope first for time A runs a full-level signal through
an integrator with constant A', then sets the level to S and changes
the integrator constant to D' (note: no "D" time here!), then on
release sets the level to 0 and the constant to R' (also no time here!)
My guess is that 2) is similar to how analog synths did it, because it
would be easy to implement using a few caps. They'd probably use a level
trigger rather than a fixed time for the "A" time value; the level
trigger needs to be somewhat below the actual full-level signal for it
to work out okay.
Cheers,
/ h+
-----Original Message-----
Sent: Thursday, March 14, 2002 10:57 PM
Subject: [music-dsp] ADSR, how?
Hello,
I'm losing sleep over how to implement ADSR envelopes!
"A" controls the time to rise from -oo dB to 0 dB.
"D" controls the time to decay from 0 dB to some level determined
by "S".
This level is held while gated and then the envelope decays to -oo dB
for some time determined by "R".
What I don't understand is does the level rise linearly in dB during
the attack phase? At first this does seem reasonable judging from
plots of musical signals. But then we can't start from -oo dB as it
would take forever and ever to reach 0 dB. What then is the initial
level? -96 dB? -144 dB? Now the initial level will affect the slope of
the attack portion quite dramatically so it doesn't seem wise to pick
some point at random.
Of course exactly the same problem occurs during the release portion
of the envelope.
How is this done in practise?
--
Emanuel Landeholm
http://w1.846.telia.com/~u84605054/
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/