PDA

View Full Version : Sending values to TouchOSC sliders



phinland
07-09-2011, 01:15 PM
My set up is iPad -> TouchOSC -> OSCulator -> Logic

I have a set of buttons sending a 'MIDI Note /w params', each taken from a corresponding fader sending 'Note Param: Pitch', such that I select the notes I want on the faders, and then trigger them using the buttons.

This works fine. However, I want to create a set of preset 'pitch sets' such that when I hit a button called 'Pitch Set 1', it sends each fader an OSC Routing fixed to the correct value for a set of pitches I want to use (say C Major).

That works in so faar as the faders move. However, the value doesn't seem to get passed on to the buttons as they still output their 'old' pitch.

Please advise?


In addition, rather than send a value of n(1/128) to the faders (where n = the MIDI note number I want) it would be much easier to send it the direct number 0-127 but even if I set the input scaling of the faders to 0-127, they still seem to respond on the basis 0-1. i.e. I send it 64 and the fader shoots to the very top.

Many thanks.

camille
07-09-2011, 01:37 PM
Hi Phinland,

I would like to help, but it is a bit difficult to anwser your question without having access to your oscd and touchosc files. I have experimented with a solution, and found it was working in some sense, but of course your could be totally different.
You can attach your files on this thread, or you can carry on this discussion by email if you prefer (camille at osculator dot net).

About the scaling of [0 127] vs [0.0 1.0] :

At the time OSCulator was designed, it was supposed to work with a Lemur, or a Wiimote. The "standard" range for numerical OSC message is a float going from 0.0 to 1.0. Some early implementations of mrmr were using an integer from 0 to 1000. Most of OSCulator events are ranging from 0.0 to 1.0, which is convenient when you are working with several OSC devices. I know that in the case of MIDI this is not convenient, this is why a multiplifier is implicitely applied for the scalings of the MIDI CC messages (some other MIDI messages do apply as well).

There might be a possibility to help with the scaling of the Note Params but first I have to check that it will not create a problem with the way Kyma notes are represented.


Best Regards,
Cam

phinland
07-09-2011, 01:49 PM
Camile, that is incredible support, replying within minutes to 3 separate posts! Thank you so much. I'm just about to email you... :)

camille
07-09-2011, 01:58 PM
My pleasure!

camille
07-12-2011, 12:10 PM
Hey Phin,

I was looking at your layout, this is very impressive!
The problem you are having here is that the "Note Params -> Pitch" value is not updated.
You should send an OSC message to OSCulator itself to update proper value.

Hint: You have faders to change the note, and preset buttons that also change the value of multiple notes. As they share the same functionality, you should use a single message that does all the "hard" work (set the Note Params, update the note labels, etc.).

This message would be internal, and called from OSCulator itself but with different values. You can even make it able to use a value from 0 to 127, and use the scaling to set it back to the proper value.

Think of it as writing a function. With this you layout should be a bit more simpler, or at least more maintainable.


Best,
Cam

phinland
07-12-2011, 03:43 PM
Many thanks, I'll look at this tonight in front of my music computer. One thing--is there no way OSC or OSCulator can 'pass on' the value? What I mean is, I have a fader which sends out two messages: a MIDI Note Pitch parameter and the note name this corresponds to (as a 'Selection From Input Value') in a display label. If I have a button which then sets the *fader* position to a particular point, why doesn't the fader in turn send out its new value, so the message 'cascades' to the correct eventual destinations?

camille
07-12-2011, 04:16 PM
There are two reasons for this:
1- TouchOSC doesn't "cascade" events, that would be have been handy, though, but read on ...
2- There is a risk for an infinite loop, when a message is received the program consumes it, and by effet triggers other events.

phinland
07-12-2011, 04:29 PM
Ah, righto. Looks like its TouchOSC again... Understood about the infinate recursion problem however, although there are always checks that TouchOSC could have performed. Another suggestion for Rob then

phinland
07-12-2011, 11:46 PM
Hi, sorry, I'm stuck.



The problem you are having here is that the "Note Params -> Pitch" value is not updated.
You should send an OSC message to OSCulator itself to update proper value.


I don't see how to do that, because the "Note Params -> Pitch" doesn't have an address per se. For example, where do I send the OSC Routing to in the Parameters page?



you should use a single message that does all the "hard" work (set the Note Params, update the note labels, etc.).
This message would be internal, and called from OSCulator itself but with different values.


Again, sorry, I just don't follow. Do you mean using Manually Create Message? Tried that, but again, don't know where to send it!

If you mean sent a specific argument a value, how do I address a specific argument of a given message?

Sorry, I'm sure I'm being dumb...:confused:

camille
07-13-2011, 01:39 AM
Absolutely no problem Phin.
Sorry if it was not very clear, here is a more detailed explanation.

The general idea is to put in only one place everything that is related to a single function.
The function you want to perform is:
- update the text labels with a new text value.
- update the Note Params / Pitch.
(- optionally, set the fader position.)

You have two ways to call this function:
1. By pressing a fader "/2/fader1", in which case there is a variable argument (note number).
2. By pressing a "preset recall" button "/2/push1", in which case there is a fixed argument (note number).

First, prepare your fader so it sends values from 0 to 127, and name it /set_note_1.
Using values from 0 to 127 will help for the MIDI notes, and changing the name will make things more clear.

Register the fader in OSCulator and assign the events to update the labels, and set the Note Params. Remember that the range of this fader is [0 127], so you have to set the input min and input max values in the scalings for each events if you want things to work as before. Leave output min and max to 0 and 1 respectively.

Now for the push button:
When this button is pressed, you want to actually call /set_note_1 with a fixed value.

The trick is to send the OSC message /set_note_1 to OSCulator itself when the button is pushed.

Go in the Parameters Window, OSC tab, and locate a free target slot (that is not the default slot). In this slot, you click on the gear button, and select the OSC service named "localhost:<port> (this document)". Say this is the slot number 2.
Then in the table at the bottom, click on the + button to create a OSC routing with "/set_note_1" as the rewrite argument. You can also set the triggering of this message to "Route when: The value goes from positive to 0". This will ensure that when the message is sent only when the button is released.
Finally, back to the table at the bottom, change the slot number to "2" (in fact, the slot you have previously chosen).

In the main window locate the /2/push1 message and assign the previously created OSC Routing. You want this message to trigger the OSC Routing with a fixed argument (since it is a "preset" recall button), so go back to the scalings page, and change output min and output max to the desired MIDI note. (actually since the OSC Routing is triggered only when the button is released, you can just set the output min, if I'm right.)

Best,
Cam