Csound Csound-dev Csound-tekno Search About

Re: phasor & tablemix

Date1999-03-16 16:25
FromCharles Starrett
SubjectRe: phasor & tablemix
I'm still stumped...I've tried all sorts of different methods to try to get
rid of the click--mostly I'm focusing on the possibility that my cross-fade
envelope ("kross") is not perfectly timed with the table swaps...

Anyhow, my last post had a poor wrap in it, so I'm including the orc/sco
pair again having made it a little more "email friendly."

Thanks again!

~~Charles

;-----------------------------------
;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

; list of function tables to fade between
f191 0 16 -2 2 8 1 1 3 4 5 6 7 9 ; iseqfn table

; other function tables
f198 0 17 -7 0 4 0 8 1 4 1 ; kross table
f199 0 4097 10 1 ; asig 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