| In the following orc/sco, I've been trying to do cross-fades in the orc
file using tablemix and have run into two problems:
(1) even when I set the period of phasor to 1/p3, it still appears to run a
bit over (see the "printk" statement)
(2) I'm getting "clicks" where I don't think I should be getting them.
They occur at the point when new f-tables are swapped into tablemix. I
have tried to compensate for this by making sure that they swap under the
following circumstances:
BEFORE: f199 = (fA)*0 + (fB)*1
AFTER: f199 = (fB)*1 + (fC)*0
It seems to be okay, but there may be a problem in the coordination of the
fade with the f-table swap which I can't work out...
Can anyone help me out here?
;-----------------------------------
;clksweep.orc
;
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 3
iamp = p4 ;
ipitch = p5 ; base pitch
iseqfn = p6 ; f-table selection f-table
istart = p7 ; start position on seqfn
idir = p8/abs(p8) ; step dir. through table (1 or -1)
idur = abs(p3/p8) ; duration of each crossfade
irange = p8 - idir ; # of positions to step through
; lookup starting and ending f-tables for each cross-fade
kphs phasor 1/p3
kndx = kphs*p8
knxtndx = kndx+idir
ktbl table kndx, iseqfn, 0, istart
knxttbl table knxtndx, iseqfn, 0, istart
printk (idur/2), kphs
; crossfade between two tables using ramp (f198) and write to f199
kross oscili 1, 1/idur, 198
kfade = 1 - kross
tablemix 199, 0, 4096, ktbl, 0, kfade, knxttbl, 0,
kross
tablegpw 199
iattrel = .05 ; attack and release times
kenv linseg 0, iattrel, iamp, p3-2*iattrel, iamp, iattrel, 0
asig oscil kenv, cpspch(ipitch), 199, -.5
out asig
endin
;-----------------------------------
;clksweep.sco
;
;-----------------\
; function tables \
;-----------------\
f1 0 4097 10 1
f2 0 4097 10 1 0 .333333 0 .111111 0 .037037 0 .012345
f3 0 4097 10 0 0 1
f4 0 4097 10 0 0 0 0 1
f5 0 4097 10 0 0 1 0 1
f6 0 4097 10 0 0 1 0 .6 0 1
f7 0 4097 10 0 0 0 0 0 0 1 0 1
f8 0 4097 10 1 .5 .333333 .25 .2 .166666 .142857 .125 .111111 .1
f9 0 4097 10 0 0 0 0 0 0 0 0 0 0 1
; lists of function tables to fade between
f191 0 16 -2 2 8 1 1 3 4 5 6 7 9
; other function tables
f198 0 17 -7 0 4 0 8 1 4 1
f199 0 4097 10 1 ; oscil table
;-----------------\
; note statements \
;-----------------\
;i3 0 2 10000 5.05 191 3 1
;i3 + 7 10000 5.10 191 0 +9
i3 + 14 10000 5.05 191 9 -9
e
--
/----Charles D. Starrett-----\ "I do not feel that
| / | ____ | | ____ | | my research suffered unduly
| /\ | |-- |-| ___| | | from the fact that I enjoyed it."
| |___ |____| | |_____| | *Daniel Miller,
\--starrett@fas.harvard.edu--/ Modernity--an Ethnographic Approach
|