Previous topicNext topic

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

Questions, comments, feedback, etc.
Post Reply
iglooooooo
Posts: 15
Joined: Thu May 28, 2020 3:24 am

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

Post 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 2841 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?
iglooooooo
Posts: 15
Joined: Thu May 28, 2020 3:24 am

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

Post 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 2837 times
So maybe the question I'm getting at here is this: how do you truly reset the count of the "Trigger (Integer)" modifier?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

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

Post by Magic »

What you want is Wrap(10) after the Trigger.
iglooooooo
Posts: 15
Joined: Thu May 28, 2020 3:24 am

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

Post 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.
Post Reply