Previous topicNext topic

Detecting a MIDI / OSC event of same value

Questions, comments, feedback, etc.
Post Reply
synthmusic
Posts: 16
Joined: Wed Sep 02, 2020 6:45 am

Detecting a MIDI / OSC event of same value

Post by synthmusic »

It appears that Magic MIDI and OSC inputs to scene modules and globals can detect a current value of a parameter, but I cannot find a way to detect that the same value was sent again. e.g. a continuous controller for a knob sending 0x01 over and over as it continues to be turned in one direction. Or if a button is pushed on a path in OSC, in many cases it sends the same value again.

Is there a way to detect a new event with the same value as previously?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Detecting a MIDI / OSC event of same value

Post by Magic »

Hmm, no, I don't think there is, but why would you want that?
synthmusic
Posts: 16
Joined: Wed Sep 02, 2020 6:45 am

Re: Detecting a MIDI / OSC event of same value

Post by synthmusic »

ok, good question - this actually takes me to several larger problem. I would really like to kick off a sequence based on an event. i.e. a button push starts a ramp from 0 and something happens on that movement. I know we can ctrl-e, but can't make that happen with MIDI, and I don't want to force it on everything, just one arbitrary value.

Further, there was a post by Kimmo recently, https://magicmusicvisuals.com/forums/vi ... f=2&t=2283 , that alludes to a similar problem. Having the calculation of different input values result in a number variable that can be stored as a global; assigned by some calculation elsewhere would be super helpful. Or knowing that an input value on MIDI *changed* from what it was before or was resent as the same value could trigger all sorts of interesting things by setting values. I intend to write this up in more meaningful examples as time allows, so take it as food for thought for now.

I think the single biggest take-away I can state here: can something MIDI or OSC reset a global, a value, or something like a ramp?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Detecting a MIDI / OSC event of same value

Post by Magic »

Having the calculation of different input values result in a number variable that can be stored as a global; assigned by some calculation elsewhere would be super helpful.
If you read the User's Guide, you'll see that Globals can be used in Expressions. https://magicmusicvisuals.com/downloads ... xpressions
can something MIDI or OSC reset a global, a value, or something like a ramp?
There are many different ways to do this. The easiest is to use the Synchronize Modules on Reselect option in the Playlist menu. When this is enabled, selecting the current playlist # (with MIDI or OSC or by clicking the button) resets the current scene.

Another way is to use the Power parameter on a module (linked to MIDI), which will reset all the modules connected to its input: https://magicmusicvisuals.com/downloads ... passParams

Yet another way is to toggle between inputs on an InputSelector. When the input # changes (via MIDI or whatever), the input modules reset.

I've been meaning to add a module whose sole purpose is to reset its inputs, which would be one step simpler than the InputSelector method, but I just haven't gotten around to it yet.
synthmusic
Posts: 16
Joined: Wed Sep 02, 2020 6:45 am

Re: Detecting a MIDI / OSC event of same value

Post by synthmusic »

If you read the User's Guide, you'll see that Globals can be used in Expressions
It is quite the expansive document and in general help information in both the guide and the interface is TOP NOTCH, and for that I am very very grateful. :) I reference it often, and I use globals in expressions all the time!

I'll start a thread on resetting ramps and other things, because it's too far OT and the tip about disabling downstream modules is super helpful, and I still have another question in that vein.
but why would you want that?
Back to original topic - I'll try 2 other examples

a) I have an OSC button on a device. When I push that button it sends a value of 1 through the pipe at /button . It's not a toggle, it doesn't have an up/down value - it can only send a value of 1 when it is pushed. I want that to bang the Goto Start on a video. Or I want that to increase the Index on a JpegFolder by 1 each push. The value is always 1.0, but that 1.0 is getting re-sent on OSC.

b) I have a MIDI knob in continuous mode. It sends 0 when turned left, and 1 when turned right. The more left it is turned, the more 0's are sent down the pipe. The more right it is turned the more 1's are sent down the pipe. So If I'm turning right, I want a global or module parameter to continue increasing each time it gets the event for as long as I'm turning, but not continue increasing when I'm not turning. You can use Increase (Linear) - set to 0.0 - to accumulate a value, but that won't work because the last sent value was a 1, even though it's not sending that event any longer.


Also, the Playlist will respond this way to events: If you send the same value for the same parameter, it still restarts the same scene.
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Detecting a MIDI / OSC event of same value

Post by Sadler »

it can only send a value of 1 when it is pushed.
a) See Eric's top tip here:
https://magicmusicvisuals.com/forums/vi ... 986&p=4407

b) I have a momentary button sending OSC to a module with Increase modifier set to 0. When I hold the button the value increases. When I release the button the value stays at its current value (stops increasing). Does that give you what you want?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Detecting a MIDI / OSC event of same value

Post by Magic »

I don't think that will give him what he wants because his button never sends out a 0.
I have an OSC button on a device. When I push that button it sends a value of 1 through the pipe at /button . It's not a toggle, it doesn't have an up/down value - it can only send a value of 1 when it is pushed
Honestly I find it very strange that someone would design a button that way. Whether on the screen or on a physical device, buttons should always have an up state and a down state. What device is it, out of curiosity?
I have a MIDI knob in continuous mode. It sends 0 when turned left, and 1 when turned right. The more left it is turned, the more 0's are sent down the pipe
I can understand that this might be useful in some other apps, but in Magic it's kind of pointless. Pretty much every parameter has a lower and upper bound, whether explicit (you can't go past a certain value) or implicit (i.e., translating too much will just go off the screen). Isn't there a way for you to configure the knob to not be continuous, in some kind of editor program for your device?
Also, the Playlist will respond this way to events: If you send the same value for the same parameter, it still restarts the same scene.
Yes, that's the way it works. Not sure what you're saying here.
Post Reply