PDA

View Full Version : How to reset a XY control to the center



camille
12-15-2010, 03:21 PM
I recently had a question about how to reset a XY control to its center when the finger is released.

27

While this is not a very complicated setup, it requires a rather good knowledge of how everything works. So here is a detailed recipe so everyone can understand more advanced features of OSCulator.

First of all we need to know how to change the position of the XY control.
When registered in OSCulator, this control usually shows up as a /1/xy1 message with two arguments: the x and y coordinates. The extent of those arguments is, like every values in TouchOSC, normalized to [0 1], which means that the center value is {0.5 0.5}. To change the state of a control, TouchOSC must receive a message matching the control's address with the correct arguments. In our case, we need to send the message /1/xy1 with two arguments: 0.5 and 0.5.

The first steps to send this message are the following:


Open OSCulator, create a new document.
Create a layout with a XY control on the first page and upload it to TouchOSC (or use the attached file).
Configure TouchOSC so it sends Z messages (in TouchOSC's configuration window, tap on Options, then "send 'z' messages). This is important because this will be how we detect when the finger is pressed or lifted.
Configure TouchOSC Network Settings to send messages to OSCulator.
Touch the XY control so it registers in OSCulator's list. Two messages are now present : /1/xy1 and /1/xy1/z
On /1/xy1/z, choose Event Type -> OSC Routing, and Value -> New …
The Parameters page is now displayed, at the botton, click the + button to add a new routing. In the Memo field, name it "Reset XY" (optional)


Now that the OSC Routing is created, we need to configure it a bit further:


In the OSC Editor window, change Rewrite Address to /1/xy1
In the Arguments field, type 0.5 followed by space, then again 0.5 followed by space.
At the bottom of the OSC Editor, in Route when choose "The value goes from positive to 0". This will send this message when the finger is released.


Usually this control is used in conjunction with MIDI CC messages. When the finger is released, we might want to send those messages as well. To do that, duplicate the /1/xy1/z message two times (hit Command-D), and assign the same MIDI CC messages used for X and Y. Go to the Scalings Page (Command-F) and change the output min and output max values to 64 for both duplicates. 64 is the middle value for MIDI CC messages.

An alternative solution for this last step would have been to send an OSC message to OSCulator itself at address /1/xy1. This would be the equivalent of simulating a message coming from TouchOSC. To do this, in the Parameters window, OSC tab, add the target localhost:8000 in the second slot of table at the top. Then, copy the routing already defined, change its target to 2 and name it "Reset MIDI". (see the attached file XY Reset (alt).oscd)



Cam

fr4gg3r
03-01-2011, 04:06 AM
Cool! Now I can make a pitchwheel which I thought would be impossible!

camille
02-06-2012, 06:22 PM
The XY Reset and a number of other examples are now located in the Samples Library folder within the OSCulator ƒ folder that you get when you download from the website.

AJL
02-23-2012, 05:55 PM
hi Camille, thans for the explanation. I would like to add that one needs to enable z messages to be sent from the ipad or iphone, this is in the options on the ipad itself, this might be obvious to others but took me a while to work out :)

i have a question: i have used this to make a pitch bend wheel that snaps back to the middle (in this case i set the min and max outputs to 8191.5, also note that pitch bend is classed as a "midi note"). my question is: is it possible to have the ipad fader also snap back to zero when it is released?

additionally i am using this setup to control VSL orchestral instruments, the signal goes from touchosc, to osculator, then to logic on the record enabled mid track, then to Vienna Ensemble Pro which is hosting all of my virtual instruments. i do not see how i can get any feedback using this method, which i can accept.

thanks in advance for any help you can provide.

camille
02-26-2012, 01:14 PM
Hi Amory,

The instruction for enabling the Z messages is the second item in the tutorial. Maybe it was not clear enough, sorry.

Yes, you can easily build a fader that resets back to 0 by following the tutorial.
Here are the instructions rewritten for a fader:



The first steps to send this message are the following:


Create a layout with a fader control on the first page and upload it to TouchOSC.
Configure TouchOSC so it sends Z messages (see configuration on the first screen). This is important since this will be how we detect when the finger is pressed or lifted.
Open OSCulator, create a new document and configure TouchOSC network settings to send messages to OSCulator.
Touch the fader control so it registers in OSCulator's list. Two messages are now present : /1/fader1 and/1/fader1/z
Select the message /1/fader1/z, choose Event Type -> OSC Routing, and Value -> New …
The Parameters page is now displayed, at the botton, click the + button to add a new routing. In the Memo field, name it "Reset Fader" (optional)

Now that the OSC Routing is created, we need to configure it a bit further:


In the OSC Editor window, change Rewrite Address to /1/fader1
In the Arguments field, type 0 followed by space.
At the bottom of the OSC Editor, in Route when choose "The value goes from positive to 0". This will send this message when the finger is released.



ps: I don't think there is an easy way to have bi-directional communications with Logic using basic mappings (control surfaces like Mackie Control on the other hand have bi-directional communication, but are not supported by OSCulator).


Best,
Cam