I have a situation in which my global a-variables don’t behave as I expected them to.
I’m sure I might misunderstand some aspect of their general behaviour, maybe someone can help?
In the following example, instr 10 is creating a ramp to either 1 or 0.
I need the variable ga_tester to stay on its value until the next time instr 10 is being called.
Alas, it doesn’t. In fact, it changes all the time.
Hi!
That’s exactly what I expected, but for some reaaon in my case ga_tester is oscillating rather weirdly all the time.
I went back to 6.18 to see if there’s any difference but there isn’t.
I am afraid that doesn’t illustrate the issue for me because
the “weird oscillation” happens over exactly one k-cycle so that at every prrink-readout the values are ok.
ksmps = 1 solves the issue (but is not possible in my situation).
This is what the signal looks like after supposedly going back to zero:
I can see the “oscillations” also. Without looking at the source I assume that the offending part is changing p3 and its effects on linseg. This modification gets rid of the oscillations:
instr 10
ga_tester linseg 1-p4, giramp, p4
if eventtime() > giramp then
turnoff
endif
endin
ah, ok but ga_tester does not change, it is the same block of ksmps that was last generated. The block may not have a single value sample, but a ramp, and that’s what you see oscillating. The way to guarantee a single value at the end is to make sure the envelope stops ramping up before the instrument stops generating it.
Prof. Victor Lazzarini
Maynooth University
Ireland