Transegr opcode

Hello everyone! :sunglasses:
So, I’m trying to use transegr in one of my instrs 'cause I need the release phase starts after I push a certain note on my MIDI device, as madsr or other opcodes ending with r do.
The definition of transegr in the main manual says: 'Constructs a user-definable envelope with extended release segment.’ the opcode works but actually, no extended release really exist. Is this a bug or what?

Cheers,

Matteo

Hi @piripero013 , welcome to the forum. This seems to work fine. The following instrument, although only scheduled to play for 1 second, will play for 3.


schedule(1, 0, 1)

instr 1 
    kres transegr 1, 3, 0, 0
    a1 oscili kres, 600
    outs a1, a1
endin

If I try to use it like you do it works but if I want a more complex envelope it doesn’t.
This is my envelope:

iatt = .003
aEnv transegr 0, iatt, 6, iamp, idur/2, 0, iamp, idur/2-iatt, -2, 0

What I have to do to have the extended release? Usually this parameter must be the last but if I put it there the compiler shows me an error due to incorrect number of parms.

Hmm, that’s true, I can’t seem to get a multi stage envelope to work either?

It’s only a problem of that opcode ‘cause if I use madsr, linsegr, or even expsegr the extended release phase works. I notice that in those opcodes’ definitions there are two parms at the end, named “irel” and “iz”, which don’t appear in transegr

I think the best thing to do at this stage would be to prepare a very simple .csd file and file an issue in the Csound github issue tracker.

All right, I’ll do it asap. Thanks!

Sheesh, that’s my fault! Doing an example for the Github Issue Forum I notice that I included p3 as a parm of the transegr opcode, which is not right while using a midi-trigger note to run the instrument. So if I do this:

	massign 0, "MidiDev"
	alwayson "MidiDev"
instr MidiDev
	itrig notnum
	icheck active "Osc"
	if(itrig==43&&icheck==0)then
		schedule "Osc", 0, -1
	elseif(itrig==43&&icheck>0)then
		turnoff2 "Osc", 0, 1
	endif

endin


instr Osc
	iamp = .5
	iatt = .003
	idec = .25
	irel = 3
	;aEnv expsegr .001, iatt, iamp, idec, iamp*.75, irel, .001
	;aEnv linsegr 0, iatt, iamp, idec, iamp*.75, irel, 0
	aEnv madsr iatt, idec, .75, irel
	;aEnv transegr 0, iatt, 5, iamp, idec, -2, iamp*.75, irel, 0, 0
iTri ftgenonce 0, 0, 4096, 7, 0, 1024, 1, 2048, -1, 1024, 0
aOsc poscil aEnv, 220, iTri

	outs aOsc, aOsc

endin

all my multi-staged envelopes work!
What a noob :sweat_smile:

Cheers to all,

Matteo

Great. I had thought to ask that, but when I failed to get it working myself I figured maybe there is something wrong. Now I have to admit that after all these years I still suck at Csound :rofl: