Csound Csound-dev Csound-tekno Search About

UDO Help

Date2005-11-12 06:15
FromDavid Akbari
SubjectUDO Help
Hi List,

I'm working on a UDO and I seem to have run into a small problem with 
using the line opcode. It seems that in this UDO, I am trying to index 
a table for use with fading out the dac. The problem is that I'm using 
line to do the table index. So it works, but only ONCE. You press the 
space bar and it fades out, you press the number 1 and it fades back 
in, but then once both lines have been executed, the value is held.

How is it possible to reinitialize the line opcode within the UDO 
block? Any help on this matter is most appreciated!




sr		=	44100
kr		=	441
ksmps	=	100
nchnls	=	2

itmp	ftgen	1, 0, 16384, 7, 0, 16384, 1
;itmp	ftgen	1, 0, 16384, 5, 0.000001, 16384, 1
;itmp	ftgen	1, 0, 16384, 20, 9, 1

/*--- ---*/

		opcode	fadedac, aa, aaii

ist	init	1
iend	init	0

aLin, aRin, ifadtime, itable	xin

kval	sensekey

;  space bar fades out
;  number 1 fades in

if	(kval == 32) kgoto	truf1
if	(kval == 49) kgoto	truf2
	kgoto cont

  truf1:
ktrue	=	1
	kgoto cont

  truf2:
ktrue	=	2
	kgoto cont

  cont:
	if	(ktrue == 1) then
kndx	line	ist, ifadtime, iend
kndx	=	kndx * ftlen(itable)
klin	table	kndx, itable
aL = aLin * klin
aR = aRin * klin
;ktrue	=	0
elseif	(ktrue == 2) then
kndx	line	iend, ifadtime, ist
kndx	=	kndx * ftlen(itable)
klin	table	kndx, itable
aL  = aLin * klin
aR  = aRin * klin
;ktrue	=	0
else
aL  = aLin
aR  = aRin
	endif

	xout	aL, aR

		endop

/*--- ---*/

		instr	1

;  put your sample here
a1, a2	diskin2	"/Volumes/Neuromancer/sup2/a1lasflutas16", 1, 0, 1

a00, a01	fadedac	a1, a2, (sr/ftlen(1)), 1

	outs	a00, a01

		endin

/*--- ---*/


i1	0	1000

e





-David

Date2005-11-12 08:27
FromIain Duncan
SubjectRe: UDO Help
Attachmentsmylinek.c  
Did you try the reinit opcode? They are a little confusing but I can 
help you out with them, I used them a ton in my monosynths. I have not 
tried them with a udo, but I haven't seen any mention that they won't 
work there. On the other hand, I did write a varient of the line opcode 
myself that restarts on certain krate conditions and that worked fine 
within a UDO. So I'm sure you could do that easily enough. Here's the 
code for my resteerable line opcode I'm working on if you want to take a 
look. You could change the reinit condition to an additional trigger 
variable instead easily enough.

Iain

David Akbari wrote:
> Hi List,
> 
> I'm working on a UDO and I seem to have run into a small problem with 
> using the line opcode. It seems that in this UDO, I am trying to index a 
> table for use with fading out the dac. The problem is that I'm using 
> line to do the table index. So it works, but only ONCE. You press the 
> space bar and it fades out, you press the number 1 and it fades back in, 
> but then once both lines have been executed, the value is held.
> 
> How is it possible to reinitialize the line opcode within the UDO block? 
> Any help on this matter is most appreciated!
> 
> 
> 
> 
> sr        =    44100
> kr        =    441
> ksmps    =    100
> nchnls    =    2
> 
> itmp    ftgen    1, 0, 16384, 7, 0, 16384, 1
> ;itmp    ftgen    1, 0, 16384, 5, 0.000001, 16384, 1
> ;itmp    ftgen    1, 0, 16384, 20, 9, 1
> 
> /*--- ---*/
> 
>         opcode    fadedac, aa, aaii
> 
> ist    init    1
> iend    init    0
> 
> aLin, aRin, ifadtime, itable    xin
> 
> kval    sensekey
> 
> ;  space bar fades out
> ;  number 1 fades in
> 
> if    (kval == 32) kgoto    truf1
> if    (kval == 49) kgoto    truf2
>     kgoto cont
> 
>  truf1:
> ktrue    =    1
>     kgoto cont
> 
>  truf2:
> ktrue    =    2
>     kgoto cont
> 
>  cont:
>     if    (ktrue == 1) then
> kndx    line    ist, ifadtime, iend
> kndx    =    kndx * ftlen(itable)
> klin    table    kndx, itable
> aL = aLin * klin
> aR = aRin * klin
> ;ktrue    =    0
> elseif    (ktrue == 2) then
> kndx    line    iend, ifadtime, ist
> kndx    =    kndx * ftlen(itable)
> klin    table    kndx, itable
> aL  = aLin * klin
> aR  = aRin * klin
> ;ktrue    =    0
> else
> aL  = aLin
> aR  = aRin
>     endif
> 
>     xout    aL, aR
> 
>         endop
> 
> /*--- ---*/
> 
>         instr    1
> 
> ;  put your sample here
> a1, a2    diskin2    "/Volumes/Neuromancer/sup2/a1lasflutas16", 1, 0, 1
> 
> a00, a01    fadedac    a1, a2, (sr/ftlen(1)), 1
> 
>     outs    a00, a01
> 
>         endin
> 
> /*--- ---*/
> 
> 
> i1    0    1000
> 
> e
> 
> 
> 
> 
> 
> -David
>