Page 1 of 1

making a 7bit knob send out smoothed 14 bit messages

Posted: Sat Sep 13, 2008 2:54 pm
by twintip
I want to use a midi knob to control the tempo in ableton, but I want bomes to convert the signal into smoothed 14 bit message, how can I do this?

Posted: Tue Oct 21, 2008 10:10 am
by florian
I think you have solved this already, right? just making sure... if not, we'd like to help!

Florian

Posted: Tue Oct 21, 2008 10:09 pm
by twintip
no! I couldn't do it, my skillz are limited.

I would love it if you could help!

Posted: Wed Oct 22, 2008 9:04 am
by florian
What kind of knob is it? a knob which outputs 0..127 (i.e. 00..7F in hex) as data, or an endless encoder? If the latter, what does it output? (use Capture MIDI in Edit Translator window).

Thanks,
Florian

Posted: Wed Oct 22, 2008 6:21 pm
by twintip
florian wrote:What kind of knob is it? a knob which outputs 0..127 (i.e. 00..7F in hex) as data, or an endless encoder? If the latter, what does it output? (use Capture MIDI in Edit Translator window).

Thanks,
Florian
it's one that does 0 - 127.

when I turn the knob say from 24 to 25, I want MT to send out all the in between values in 14 bits (over 0.05 second or something).

It is for controlling tempo in live. Using a 7 bit knob can make clips sound jerky. I want it to be nice and smooth

Posted: Thu Oct 23, 2008 12:43 am
by florian
Hi Twintip,

that'll work with MT Pro. It's fun!

I'll write it down without testing (no time now!), bear with me if it doesn't work at once...
Translator 1: Controller Input (set target value gt)
Incoming: MIDI B0 01 pp
Rules:
gt = pp * 128
if pp=127 THEN gt = 16383
Outgoing: start timer SMOOTH: 0ms initial, 10ms repeat delay, indefinitely

Translator 2: calculate and send out smoothed value. gc=current value
Incoming: Timer SMOOTH
Rules:
if gc < gt THEN GOTO "increase"
Label "decrease"
gc = gc - 3
if gc < gt THEN gc = gt
GOTO "cont"
Label "increase"
gc = gc + 3
if gc > gt THEN gc = gt
Label "cont"
pp = gc & 127
qq = gc / 128
Outgoing: MIDI E0 pp qq

Translator 3: stop timer if necessary
Incoming: Timer SMOOTH
Rules:
if gc != gt THEN "exit rules, skip Outgoing Action"
Outgoing: Stop timer SMOOTH
Some explanations:
- gt is a variable that has the "want to be" 14-bit value.
- it's difficult to come up with a "smooth" transition from 7-bit range to 14-bit (i.e. calculating the target value). In this case, I just set it to the max 14-bit value (16383) if you use the max 7-bit value (127).
- then a timer is started. The repetitive delay (10ms) determines how fast the target value will be reached: the smaller ms, the faster.
- translator 2 will slowly adapt the "current value" (gc) to become, eventually, gt. In the example I go in steps of 3. You may need to adapt this. Larger values: faster.
- then, translator 2 will calculate the high byte in qq and the low byte in pp.
- as outgoing action, I send out a pitch bend message -- just as example. You can also output two controller messages as outgoing action, with pp and qq as values.
- translator 3 examines target value and current value. If they match, the timer is stopped -- mission accomplished! (until the next controller message comes in...)

Hope that works!
Florian

Posted: Thu Oct 23, 2008 8:44 am
by twintip
:D

worked straight off!
thanks florian, will be testing this this weekend!