Expressivity in Blade Style Mathematical Functions

I’ve programmed about 4 bladestyles now, so I have some semi advanced topics to ask about. I’m exclusively programmed them in Proffie OS 6.7 and haven’t tried any other versions.

Here are some operations that I feel would be useful if we had them, but can be worked around:

Subtraction -
Reasoning - We nave Sum<> but not Subtract<> or Difference<>. Suppose you are making an effect for the last 4 seconds of a sound. It would be great to be able to use Difference<WavLen<EFFECT_FORCE>,Int<4000>>
Workaround - The function Invert allows for “1.0-X” or in fixed point that is “32768-X”, so if you add the quantity you want to subtract to 32786, that allows you to strictly subtract that value as “32768-(32768+X)” = “32768-32768-X” = “-X”. So lets saw I want to subtract 4 seconds I would use

Division -
Reasoning - We have Mult<> but not Divide<>
Workaround - @NoSloppy taught me about the Percentage<> function and this is the easies way to use division. Percentage is just X*(Y) where Y=1/Z *100. So if you want to divide by 4 you would use:
Percentage<WavLen<EFFECT_FORCE>,Int<1/4 * 100>>
The other option is to use Scale<>. In this case you’re dividing by 4 and then cnahging the range at the same time. So if you want to divide by 4 you have to reduce the typical range from 0-32768 to a range of 0-32786/4 = 0-8192. Something like:
That places the fraction at the bottom of the range. If you need to invert the function, like 32768-(X/4), you can do that in a single Scale like:

Triggers with Invert (Rising Edges and Falling Edges)
Reasoning - We have Trigger<> and it allows you to rise to 32768, then stay there for a while, then drop down again. What if you want a different transition shape.
Workaround - Regular transitions are of the form:
Trigger<EFFECT_FORCE,[Rise time],[Wait time],[Drop time]>
If you just want the opposite, use InvertF like this:
InvertF<Trigger<EFFECT_FORCE,[Drop time],[Wait time],[Rise time]>>
If you want to wait at zero for some time and then rise to high forever use:
InvertF<Trigger<EFFECT_FORCE,0,[Wait time],[Rise time]>>
If you want to wait at high for some time and then drop to zero forever use:
Trigger<EFFECT_FORCE,0,[Wait time],[Drop time]>

Here are some operations that I just don’t know how to do, maybe you have a workaround that can be shared?

Reasoning - Sometimes your doing math on a function and the result is below 0 or over 32768. We should be able to say Clamp<X,[Low value],[High value]> or Saturate< X > which does 0 and 32768 without specifying. We need this for some of the results of Mult<> or Sum<> commands. In practice, when numbers go out of range, all sort of funky stuff happens to the colors.

Quote Effects
Reasoning - We have something like WavLen<EFFECT_FORCE> but we don’t have WavLen<EFFECT_QUOTE>. I would really like to create effects for the quotes in quote mode…

Please respond if you have any other workarounds and please encourage Fredrik to add these functions if possible.

All of these are already in OS7 :wink:.


This is great news! Thank you @Fett263 ! I realize I forgot to mention it would also be very useful to expand on the phase of the sine wave and perhaps introduce a cosine wave just because it would be in phase with a sine wave. Also if the timer for these waves could be triggered by an effect trigger, because now they all just seem to be timed to a system clock which may or may not hit when you need it. Keeping the old functions would be fine but maybe some new more powerful functions could be added. I could save on some memory rather than using transitions in a lot of cases when I shouldn’t. This is the only major thought I left out here.
I’m working on some sine intensive stuff that I’ll try to send to you soon!

Probably easier if you just explain what you’re actually trying to do, there’s a lot of ways to accomplish.