Skip to content
Forum Archive

What am I missing?

7 posts

JFASI#

What am I missing?

Here is a little test of a piece of code that I'm trying to get juuuuuust right for my upcome pack I have in the works. It's supposed to save the value of the getosc at each point on the superscope and assign it to a gmegabuf. For the sake of testing, I made it represent itself graphically on the screen. But, the thing only flashes for one frame, the beat frame, and then disappears. What is wrong? Here is the code and the concept preset:

n=500


n1=0;
bt=0


bt=1


n1=n1+1;
wave=if(bt,getosc(n1/n,.1/n,0),wave);
assign(gmegabuf(n1),wave);
x=2*i-1;
y=gmegabuf(n1)
Tuggummi#
WTF.?

Even i can answer that!

Uhm....

Actually im too drunk to answer that... sorryu :giro:


sirry!
MaTTFURY#
not that i should be giving help, but for a fact, i know you shouldn't try to divide anything from N, no matter what its size, just use a different variable.
jheriko#
wave=if(bt,getosc(n1/n,.1/n,0),wave);

what is wave set to?

😉

EDIT: okay... maybe its not that obvious, basically by using 'if' the way that you have wave is only being set to the correct value when bt is not zero, i.e. on beat frames, the rest of the time it will remain whatever it was last set to because nothing has overwritten the previous value, fix:

wave=if(bt,getosc(n1/n,.1/n,0),gmegabuf(n1));
assign(gmegabuf(n1),wave);

even better, cut out the redundant wave variable:

assign(gmegabuf(n1),if(bt,getosc(n1/n,.1/n,0),gmegabuf(n1)));

now the gmegabuf is updated on beat, and left as the correct old value when its not a beat.
Tuggummi#
Just like Jheriko said.






Actually i have no idea 😛 I thought you were just having some silly megabuf-not-working problem, that code looks a bit hazy to me 🧟
JFASI#
Originally posted by Tuggummi
Actually i have no idea 😛 I thought you were just having some silly megabuf-not-working problem, that code looks a bit hazy to me 🧟

I thought pretty much the same thing because this is my first attempt at actually using gmegabuf for what it was designed for.