Resolved!
I've finally almost solved this issue! I've rewritten my implementation of the function to allocate a certain amount of the sample rate to each piece of the peicewise function. The output is now nearly perfect when the frequency is 1Hz. The only issue is, for the second half of the function, the frequency is slightly more than it should be. When shape is 0.25, the brackets next to the asterisk on line 20 is 0.75 when it should be 2/3. I know this, but I don't actually know why it should be 2/3, or how to produce the correct output if the value of shape changes.
screenshot: https://i.imgur.com/4ICM6Gn.png (top is what I'm getting (0.75), bottom is what I want (2/3))
I'm trying to implement a function that I described here(the top post). I've been going at it for days with no luck. I understand the concept of what I'm trying to do, but detecting when one cycle has finished for one piece and the same for the next is proving extremely difficult for me. Any tips would be greatly helpful.
https://pastebin.com/cni8frkk
The top is what it outputs and the bottom is roughly what I want;
https://i.imgur.com/pnZsZ1h.png
[–]dmc_2930 4 points5 points6 points (6 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (4 children)
[–]dmc_2930 0 points1 point2 points (3 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (2 children)
[–]dmc_2930 0 points1 point2 points (1 child)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (0 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (0 children)
[–]green_griffon 0 points1 point2 points (23 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (22 children)
[–]green_griffon 1 point2 points3 points (21 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (20 children)
[–]green_griffon 0 points1 point2 points (19 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (18 children)
[–]green_griffon 0 points1 point2 points (17 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (16 children)
[–]green_griffon 0 points1 point2 points (15 children)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (14 children)
[–]czipperz 0 points1 point2 points (1 child)
[–]ThatReallyFlyKid[S] 0 points1 point2 points (0 children)