| As a matter of course, I would put all of these segments into 2 tables and
read it with tablei. The first table contains the durations (as absolute note
time, not time intervals), the second the points. So:
ktswitch init 0
kindex init 0
kincrem init 0
istartcps table 0, 2
kcps init istartcps
kcurtime times
if ktswitch < kcurtime kgoto proc
kindex = kindex + 1
koldtime = ktswitch
ktswitch table kindex, 1
knewcps table kindex, 2
kincrem = (knewcps - kcps) / ((ktswitch - koldtime) * ksmps)
proc:
kcps = kcps + kincrem
f1 is the table of times
f2 is the table of frequencies
While ktswitch is less than the next time value, csound will jump over the
initialization stuff and just add the increment to kcps. Once the ktswitch
time value is reached, the next time value is read into ktswitch. The next
freq value is read into knewcps. Then kincrem is calculated to increment kcps
by the correct amount until it reaches knewcps just at the next time value. I
know it looks like a lot, but it allows you to keep all of those envelope
points in a table, which is a much better place for them. Just use gen02 to
create the tables.
--
Mike Berry
mikeb@nmol.com
http://www.nmol.com/users/mikeb
|