Csound Csound-dev Csound-tekno Search About

differing behaviour of linseg and expseg with xtratim/release

Date2007-09-07 09:29
FromJonathan Murphy
Subjectdiffering behaviour of linseg and expseg with xtratim/release
Hi All,

Just wondering if anyone can explain why the behaviour of linseg and
expseg is fundamentally different (obviously not in terms of
timbre/maths). expseg seems to ignore xtratim/release, whereas linseg
does not. In this instrument the left channel (expseg) releases after
0.11 seconds, whereas the right channel (linseg) releases after 2
seconds (which according to the code - to all intents and purposes
identical in each case -  is correct). Is this undocumented/buggy, or
is there something that I've missed?

Thanks in advance,
Jonathan.



;-+rtaudio=alsa -+rtmidi=alsa -Mhw:1,0 --expression-opt -odac -d -m0 -f -W -b-4 -B256				



  sr		=		48000
  ksmps		=		16
  nchnls	=		2
  0dbfs		=		1
		massign		0, 0
		massign		1, 1
  gisin		ftgen		1, 0, 32768, 10, 1

                opcode env_exp, a, iiii

  iatt, idec, isus, irel	xin		
		xtratim		irel
  krel		release		
  if (krel == 1) kgoto rel
  aenv1		expseg		0.0000001, iatt, 1, idec, isus
  aenv		=		aenv1
		kgoto		done
rel:
  aenv2		expseg		1, irel, 0.0000001
  aenv		=		aenv1 * aenv2
done:
		xout		aenv

                endop

                opcode env_lin, a, iiii

  iatt, idec, isus, irel	xin		
		xtratim		irel
  krel		release		
  if (krel == 1) kgoto rel
  aenv1		linseg		0, iatt, 1, idec, isus
  aenv		=		aenv1
		kgoto		done
rel:
  aenv2		linseg		1, irel, 0
  aenv		=		aenv1 * aenv2
done:
		xout		aenv

                endop


                instr 1

		midinoteoncps	p4, p5
  kcps		=		p4
  kvel		=		p5
  aenvL		env_exp		0.01, 0.1, 0.5, 0.3
  aenvR		env_lin		0.01, 0.1, 0.5, 0.3
  aosc		oscil		1, kcps, gisin
  aoutL		=		aosc * aenvL * kvel/127 * 0.5
  aoutR		=		aosc * aenvR * kvel/127 * 0.5
		outs		aoutL, aoutR

                endin



f 0     3
i 1     0       2       440       127
e