TouchOSC Pushbutton Sample&Hold

gtoledo3's picture

I was making a grid of buttons with TouchOSC yesterday, and wanted to set it up so that each button had a value assigned to it, and when someone pushes the button for the value to stick until they push the next button. So, if button 1 is pressed, it delivers a 1, then if button 5 is pressed it delivers a 5, for example - with only one value allowed to be generated in the button grid.

When I was looking through the options, there are pushbutton types that generate a value only when your finger is on the button, and then toggle types that you push on, then off.

The "problem" for using the toggle type for me, was that you could have multiple buttons depressed, whereas I needed the grid of buttons to only be able to deliver one output value - the last pressed.

I started fiddling around with some math patches and sample&holds, and realized I'd started recreating a part of smokris's VCR composition.

The solution is pretty simple - use the pushbuttons, and multiple each button value by the ID # that the button is supposed to have. Then, sum them all. Connect the output of the summing to the value input on a Sample & Hold. That's it! :-) I'm attaching a picture to show the setup.

PreviewAttachmentSize
TouchOSC Multipush Sample&Hold.jpg
TouchOSC Multipush Sample&Hold.jpg200.63 KB

voxdeserti's picture
Re: TouchOSC Pushbutton Sample&Hold

Yes! I usually use an expression "1a1+2a2+3*a3+..." with a rule "result!=0" for sample&hold.

dust's picture
Re: TouchOSC Pushbutton Sample&Hold

how does one use the touchosc encoder in qc ?

gtoledo3's picture
Re: TouchOSC Pushbutton Sample&Hold

I'm just talking about receiving OSC messages from a device running a TouchOSC designed GUI, using the qcOSC plugin to receive them. (The qcOSC plugin has really gotten good over time too.)

dust's picture
Re: TouchOSC Pushbutton Sample&Hold

i have been using the stock osc and midi patches to get data from touch osc. the issue I'm referring to is not how to get the data into qc. with a regular rotary potentiometer style knob i can send a range of numbers to qc. like midi 0 to 1 or 0 to 127 etc.. actually its nice with the touchosc editor i can set the range to be 0 to 360 if i want etc... with the encoder I'm able to map it as a rotary 7fh/01h style type of jog wheel. the thing with the encoder is it doesn't send out a range of numbers 0 to 127 it will only send out the 0 or the 127. so at first it seemed to be sending increment decrement values but basically all its telling you is forwards or backwards.

i suppose that is all an endless encoder knob is supposed to send. my question really is about how would you take the endless encoder forward backward signals and interpolate that into a range of numbers lets say 0 to 360. the answer i have come up with is to use the touchosc x and z parameters with the interpolation patch. the touchosc x parameter is set 0 to 1 range and the z parameter a note or zero or one as well. touchosc is nice in this way of sending multiple parameters from one guy element.

the encoder is a 1 going clockwise and a 0 going counter clockwise. the one and zero play nice with a multiplexor logic gate so i decided to use an interpolation patch and multiplexors to switch the start and end times to go forwards and backwards then used the z parameter note or on off value to set the sample input of a inertia patch. this all works surprising well emulating a jog wheel or record... see the pic for wiring. what I'm interested in and trying to do is to get a 270 value of lets say 9 o'clock position on the encoder like a rotary does. so i was more or less wondering how this is possible with the encoder.

PreviewAttachmentSize
Screen Shot 2012-06-23 at 7.49.34 AM.png
Screen Shot 2012-06-23 at 7.49.34 AM.png84.83 KB

gtoledo3's picture
Re: TouchOSC Pushbutton Sample&Hold

Oh, I see what you meant now... I forgot there was an object called an "encoder".

The main reason for using that grid button approach as opposed to a slider or rotary is so there is a clearly defined place that triggers a set value. You can sort of do that with a fader or rotary, but it's harder if the range of values is large.

I'm not sure about getting that particular value at that place with the encoder as opposed to the rotary if it doesn't generate floats.

I'm guessing the encoder has something cool that makes it where you can't just use the rotary? One idea that may be OK is to set it to a 0~1 range (or -1 to 1?), and use an Integrator patch, so that when the encoder thing goes to 1, the value increments gradually, and then backwards when opposite. The user would have to look at whatever it's doing and decide when to let go though. You could even do a thing where after X time the speed gets faster.