Magic

Music Visuals
https://magicmusicvisuals.com/forums/

Expression Help: Triggering up from 1 to 10, then back to 1

https://magicmusicvisuals.com/forums/viewtopic.php?f=2&t=2655

Page 1 of 1

Expression Help: Triggering up from 1 to 10, then back to 1

Posted: Sun Sep 05, 2021 9:30 pm
by iglooooooo
Screen Shot 2021-09-05 at 3.52.47 PM.png
Screen Shot 2021-09-05 at 3.52.47 PM.png (112.71 KiB) Viewed 831 times

Question about using the Trigger and Expression modifiers. I think I may just need the correct expression to get this to work (but maybe it's another modifier). Current configuration is in screenshot above.

Desired behavior:
I am using a MIDI foot controller to increase a parameter's value by 1 every time I press it.
-It starts at 1 (or 0).
-Each foot press increase value by 1, and it eventually reaches 10.
-After 10, I'd then like the next foot press to result in a value of 1.

In other words, I'd like to repeat 1 to 10 on a loop ad infinitum. (1 2 3 4 5 6 7 8 9 10, 1 2 3 4 5 6 7 8 9 10, etc)

Current behavior:
https://youtu.be/9Z2zboW4wI8

As seen in my video recording above, this is almost working as desired with my current configuration. The value successfully resets back to 1 after reaching 10 the first time. However, after reaching 10 the second time, it then continues on to 11, 12, 13 etc.

This is the expression I'm using:
Code: Select all
if (x > 10, x - 10, x)

(If x is greater than 10, subtract 10 from x. Otherwise remain unchanged)
I was hoping that this would mean every time x goes to 11, it subtracts 10, thereby restarting back at 1. But like mentioned above, this only works the first time.


What do I need to change to have the value always go from 10 back to 1?

Re: Expression Help: Triggering up from 1 to 10, then back t

Posted: Sun Sep 05, 2021 10:05 pm
by iglooooooo
I realized that what I'm trying to essentially do here is to restart the module, so I added a restart module. However, this yielded the same results: it jumped back from 10 to 1 the first time (as desired), but the next time it went 10, 11, 12, 13 etc. So I'm still stuck.

Screen Shot 2021-09-05 at 4.59.53 PM.png
Screen Shot 2021-09-05 at 4.59.53 PM.png (250.85 KiB) Viewed 827 times

So maybe the question I'm getting at here is this: how do you truly reset the count of the "Trigger (Integer)" modifier?

Re: Expression Help: Triggering up from 1 to 10, then back t

Posted: Sun Sep 05, 2021 11:44 pm
by Eric
What you want is Wrap(10) after the Trigger.

Re: Expression Help: Triggering up from 1 to 10, then back t

Posted: Mon Sep 06, 2021 4:17 pm
by iglooooooo
Thank you, Eric. Much appreciated.

I wasn't able to deduce that the wrap modifier would be the solution after first reading it's description in the manual, but makes more sense now.

All times are UTC
Page 1 of 1