First multiply the gain by some envelope, as in the manual (pg 165):
STK - Envelopes
Envelope
• STK envelope base class.
Unit Generators
• see examples/
sixty.ckThis class implements a simple envelope
generator which is capable of ramping to
a target value by a specified \e rate.
It also responds to simple \e keyOn and
\e keyOff messages, ramping to 1.0 on
keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
[ctrl param]
.keyOn (int, WRITE only) ramp to 1.0
.keyOff (int, WRITE only) ramp to 0.0
.target (float, READ/WRITE) ramp to arbitrary value
.time (float, READ/WRITE) time to reach target (in second)
.duration (dur, READ/WRITE) time to reach target
.rate (float, READ/WRITE) rate of change
.value (float, READ/WRITE) set immediate value