Page 1 of 1

Encoders

Posted: 01 Jan 2012 22:20
by Sambo
Really could do with encoder support for mapping to jog wheels / shuttle wheels. The infinte knob has a constant value and unfortunately programs like Traktor won't read anything outside of a -1 to 1 value. So using that, you can get a brief jog wheel, but then it stops haha.

I recall that encoders send impulses as opposed to having a constant value don't they? Either way, I would LOVE to see these. TouchOSC did not have these for quite a while but eventually put them in. I would have thought it was an essential type of control to have!

Unless of course encoders are already in and I'm just being stupid.

Re: Encoders

Posted: 01 Jan 2012 23:08
by Psyk
I have aproblem with them when i map it to seek songs trough browser up/down. If i roll it no mather on which side, the highligt in browser will only go down, so no matter if i roll it on the right or on the left...
If i use the TouchOSC Encoder, it works fine.

Re: Encoders

Posted: 02 Jan 2012 11:25
by marino_liine
Hi guys,

Added to the wishlist ;)

Cheers,
M.

Re: Encoders

Posted: 03 Jan 2012 04:55
by highmountain
I uploaded this template to the User Library, which implements a rotary knob. I also put more documentation than you're likely to need for it in the comment.

Re: Encoders

Posted: 06 Jan 2012 14:00
by tdmusic
I've implemented a "touch strip" for seeking through a track in Traktor. I've not got my laptop on me, but I'll share the code if it's of any interest.

Basically the way it works is it is a range object with a range of 0-1, with the center at 0.5 (using physics to snap back instantly to 0.5 when you release). When you touch it, it stores the initial touch position as the zero point - so if you touch it and keep your finger still, it outputs a value of 0.5, then as you move your finger it outputs a value relative to the start point so e.g. if you touch it 80% of the way along, then move your finger to 90%, it will output a value of +10%, i.e. 0.6. This is then mapped to track seek in Traktor, with some acceleration, so if you touch it and move your finger slightly to the right, it will seek slowly forward, increasing speed as you move further right, stopping when you release.

The one big problem I had was making Traktor keep seeking when you don't move your finger - Lemur will only output the value once until it changes, so e.g. it might output 0.5, 0.525, 0.55, 0.575, 0.6 as you move your finger along, but then won't output anything else until you move your finger again. Traktor doesn't seem to support the encoder doing this, so it would stop seeking as soon as your finger stopped moving. Maybe I missed something in Traktor's MIDI mapping, but the way I worked around this is to introduce a "jitter" in Lemur, so while your finger is touching the strip, it keeps switching the output between (value) and (value + 1/128) on each frame, so e.g. it will output MIDI CC values of 80, 81, 80, 81 even though you really just want to output 80 - this convinces Traktor to keep seeking :)

Re: Encoders

Posted: 07 Jan 2012 22:33
by Psyk
tdmusic wrote:I've implemented a "touch strip" for seeking through a track in Traktor. I've not got my laptop on me, but I'll share the code if it's of any interest.

Basically the way it works is it is a range object with a range of 0-1, with the center at 0.5 (using physics to snap back instantly to 0.5 when you release). When you touch it, it stores the initial touch position as the zero point - so if you touch it and keep your finger still, it outputs a value of 0.5, then as you move your finger it outputs a value relative to the start point so e.g. if you touch it 80% of the way along, then move your finger to 90%, it will output a value of +10%, i.e. 0.6. This is then mapped to track seek in Traktor, with some acceleration, so if you touch it and move your finger slightly to the right, it will seek slowly forward, increasing speed as you move further right, stopping when you release.
My friend, that`s even better than Encoder! So i will try to do that myself, if i fail at certain amount of time, i WILL contact you :)

Re: Encoders

Posted: 08 Jan 2012 15:50
by tdmusic
Here you go mate, try this. It's very "alpha" - assign the MIDI you want to the "outputX" expression rather than "x".

Code: Select all

<JZML>
<WINDOW class="MultiSlider" text="SeekStrip" x="0" y="0" width="351" height="52" id="15" state="1" group="0" font="tahoma,10,0" send="1" osc_target="-2" midi_target="-2" kbmouse_target="-2" bipolar="1" capture="1" color="4405618" gradient="1" grid="0" grid_steps="1" horizontal="1" label="0" multicolor="0" nbr="1" physic="1">
<PARAM name="x=" value="0.500000" send="17" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/x" midi_target="-1" midi_trigger="1" midi_message="0xB8,0xB8,4,4" midi_scale="0,16383" osc_scale="0.000000,1.000000" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="tension=1" send="0" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/tension" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="friction=1" send="0" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/friction" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="height=0.5" send="0" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/height" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="light=0" send="0" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/light" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="outputX=" value="0.500000" send="17" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/outputX" midi_target="0" midi_trigger="1" midi_message="0xB8,0xB8,4,4" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="inc=0" send="1" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/inc" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="touchStart=-1" send="1" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/touchStart" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="judderAmount=0.005" send="1" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/judderAmount" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<VARIABLE name="prevX=-1" send="1" osc_target="0" osc_trigger="1" osc_message="/SeekStrip/prevX" midi_target="-1" midi_trigger="1" midi_message="0x90,0x90,0,0" midi_scale="0,16383" kbmouse_target="-1" kbmouse_trigger="1" kbmouse_message="0,0,0" kbmouse_scale="0,1,0,1"/>
<SCRIPT name="onFrame()" script="// If the slider is at rest and hasn't been moved, reset to 0
if(x == 0.5) {
  touchStart = -1;
  outputX = 0.5;
  prevX = 0.5;
  return;
}

prevX = x;
if(touchStart == -1) {
  touchStart = x;
} else {
  outputX = 0.5 - (touchStart - x);
}

// Add 'judder' to the output so Traktor keeps seeking when it is held still
if(outputX != 0.5) {
  if(inc < judderAmount) {
    inc = judderAmount;
  } else {
    inc = -judderAmount;
  }
  outputX = outputX + inc;
} " trigger_script="" trigger_type="1" trigger="1" osc_message="/SeekStrip/onFrame" midi_message="0x90,0x90,0,0" midi_target="-1" flag="1"/>
</WINDOW>
</JZML>

Re: Encoders

Posted: 13 Jan 2012 23:26
by Psyk
I`m not sure if i know the right way to use this, what would be the name of the script etc.? :?