Need Help to Make Endless Rotary Knob Send Only OSC 1 or 0

Discuss problems and solutions.
Post Reply
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Need Help to Make Endless Rotary Knob Send Only OSC 1 or 0

Post by tater01 »

Hello everyone!

I need help making an endless rotary knob send only OSC 1 for clockwise and OSC 0 for counterclockwise.
I'm trying to get an endless rotary knob to work in Reaper for zoom, scrub, etc. I can get it working in other competitor apps, but not Lemur. So I know that Reaper is looking for only two OSC values. As is, Lemur sends endless numbers growing incrementally. 0, 1, 2, 3, 4, etc for clockwise and 0,-1, -2, -3, -4, etc for counterclockwise. The number grows incrementally each direction. For Reaper I need and endless rotary knob that sends a repetive/constant OSC out of 1for spinning the knob clockwise. And a repetitive/constant OSC out of 0 for spinning the knob counterclockwise.

I've looked on the forums and projects and have found some very great examples of endless knobs that do this for midi. Thank you great community for those! I need it for OSC though. Here is an example of an endless rotary knob that sends basically a midi 127 or 1:
Examples.jzml
Midi Example
(3.52 KiB) Downloaded 92 times
I need it to send 1 or 0 for OSC though if anyone can help.

Thanks in advance to anyone who wants to share their knowledge and hard work!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by oldgearguy »

The easiest way is to turn off the default MIDI/OSC outputs for the object and use a script to send the information.

Attached is a modification showing how to send 0 or 1 only.
You have to do some work to determine the proper syntax for the oscout() function in the script. Once you do that, it should 'just work'. I've never needed/used the OSC part of Lemur so I can't help there.
Attachments
BinaryExample.jzml
(3.56 KiB) Downloaded 88 times
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by tater01 »

Ok buddy,
I did some work and can get almost the exact messages I need going out. Almost!
So, Reaper lets you monitor the incoming osc messages and I know exactly what I need it to say. I can get zoom, scroll, etc to work in competitor apps, don't want to say their inferior name around here. And Reaper will operate scroll with the osc message "/scroll [f] 1.00000" for clockwise or scroll forward. And "/scroll [f] 0.00000" for counterclockwise or scroll back.
I got the osc messages working in this example:
ScrollExample.jzml
Almost right osc messages
(3.6 KiB) Downloaded 89 times
But! It is sending this message, "/scroll 1" for clockwise, and "/scroll 0" for counterclockwise.

I don't really see the difference between the messages accept the [f] and the further decimal places?
How can we make it send a [f] instead of ?

Just looking around and by default Lemur's endless rotary knob sends [f] messages but with growing incremental numbers. Wish there was a way to just limit the numbers of the default knob/x values to only send 1 or 0!

Thanks!
Last edited by tater01 on 16 Dec 2016 14:51, edited 1 time in total.
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by oldgearguy »

in the sendBinary() script, instead of setting outval to 0 or 1, set it to 0.00000 or 1.00000 like this:

Code: Select all

outval = (x - lastX > 0) ? 1.00000 : 0.00000;
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by tater01 »

Done!!!!

Good job man!
Thank you very much! Told you that would be easy for a smart guy like you!

Well here it is for the rest of the world:
Reaper Scroll Example Final.jzml
Finished Scroll wheel for Reaper
(3.61 KiB) Downloaded 84 times
Just add this line to your .reaperosc file:

SCROLL_X- r/Scroll
SCROLL_X+

And voila! Scroll will work in Reaper! You could adapt it for zoom and scrub in Reaper also!

Thanks again oldgearguy!
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by tater01 »

Ok, so rotary knob works great!

Thank you very much oldgearguy.

I have no problems with it at all. But, I was just wondering if there was a way to scale the output. Like change the speed of it. I don't want to change the values it sends. Just the speed or frequency at which it sends it. The knob works great for scrub, scroll, and zoom in Reaper. But zoom goes a little to fast. So if there is a way to change this that would be great!
I imagine it would be adding a *2 to the x value to speed it up and *.5 to slow it down. But not sure where in your script I should add that to the x?

Thanks again!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by oldgearguy »

tater01 wrote:Ok, so rotary knob works great!

Thank you very much oldgearguy.

I have no problems with it at all. But, I was just wondering if there was a way to scale the output. Like change the speed of it. I don't want to change the values it sends. Just the speed or frequency at which it sends it. The knob works great for scrub, scroll, and zoom in Reaper. But zoom goes a little to fast. So if there is a way to change this that would be great!
I imagine it would be adding a *2 to the x value to speed it up and *.5 to slow it down. But not sure where in your script I should add that to the x?

Thanks again!

Not sure what you mean about slowing it down, but you can try modifying the sendBinary() script to this:

Code: Select all

outval = (x - lastX > 0) ? 1.0000 : 0.0000;

if (abs(x - lastX) > 0.5) {
   lastX = x;
   oscout(0,'/Scroll',outval);
}
If that's too slow, play around with the 0.5 number. The closer to 0.0000 it is, the more frequently the update happens
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by tater01 »

Thank you very much! That works perfectly, adjusted the number to .035 just to slow it some. Thanks! Very great!

One more question and I'm done with this knob. I made another example below. In this one I just added a button. My goal is to have the button change the oscout value to a different one. So I could do horizontal or vertical scroll. So, as is the message is set to horizontal scroll. I would like to be able to change the message. When the button is off it sends the message it has now: oscout(0,'/Scroll',outval);. When you push the button I would like it to send a different message: oscout(0,'/Scroll2',outval);.
Reaper Scroll Ex With Change.jzml
(4.5 KiB) Downloaded 78 times
I could achieve this with a show/hide button with two separate knobs. Just thought it would be cool to use the same knob!

Thanks again for your help!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by oldgearguy »

not sure exactly what needs to be in that field, but here's something.
Attachments
Reaper Scroll Ex With Change2.jzml
(5.07 KiB) Downloaded 81 times
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: Need Help to Make Endless Rotary Knob Send Only OSC 1 or

Post by tater01 »

Once again, the master "oldgearguy" comes through again.
Thank you. That was exactly what I was looking for!
Much better for me to have endless rotary for zoom, scroll, jog/scrub. Got them all working perfectly. Thanks!

For anyone who wants an endless encoder knob to control zoom, scrub, and scroll with vertical and horizontal change, here ya go:
Endless Knobs with vert_horiz change.jzml
Set of knobs for Scrub, Scroll, and Zoom in Reaper
(13.18 KiB) Downloaded 88 times
Just add these lines to your .reaperosc file:


SCROLL_X- r/Scrollhorizontal
SCROLL_X+
SCROLL_Y- r/Scrollvertical
SCROLL_Y+
ZOOM_X- r/Zoomhorizontal
ZOOM_X+
ZOOM_Y- r/Zoomvertical
ZOOM_Y+
SCRUB r/Scrub

Totally done with this one. I can't think of any other way for it to be more perfect. Thank you oldgearguy!
Post Reply