# Why don't all my samples in a ramp wave reach zero?

I have attached a ramp wave CHOP example. What I want is a wave that cycles with each sample an integer value below the next sample.

i.e. on frame one, values would be 0-5, next they would be 1, 2, 3, 4, 5, 0 etc.

To do this I made the chop have a 5 sample length, and then a period of 6 samples (so that the last sample that goes back down to zero is not evaluated). I then make the amplitude 5.

However, when I adjust the phase of this wave, only the first sample goes to zero, the rest of the samples, when shifting the phase, come close but do not reach zero.

Additionally, my samples do not stay between 0 and 5. On the second frame of a cycle, the first sample’s value is above 0.

I need the wave to just translate the wave to the left infinitely. Could somebody explain this wave behavior?

Thanks
wave.toe (3.82 KB)

See if this works for you:

I used more nodes than really needed to make the mechanics clear but changing the constant variable at the start of the chain as well as the constant plugged into the speed will let you vary things up a bit.
wave.1.toe (4.56 KB)

Just as a little explanation, to always hit 0 the phase will have to hit certain values spot on.
So in your example it would have to be any multiple of 1/6

Unfortunately these are not nice fractions and with seconds being floats themselves it is unlikely that you will always hit the right phase. Additionally with increasing numbers the precision of the fraction deteriorates so you would have to make sure to just operate in the 0 to 1 range.

changing your expression slightly or using the attached little CHOP network will take care of this:

``int(absTime.seconds)%6/6``

In the attached file, I’m just using a couple CHOPs to get to that number…

Cheers
Markus
waveVersion.toe (4.29 KB)

Ahh, this is even better.

Thanks a million.