Soft Takeover Hack

Share your favorite Ableton Live tips, tricks, and techniques.
Post Reply
Shebb
Posts: 16
Joined: Wed May 11, 2005 3:44 pm

Soft Takeover Hack

Post by Shebb » Wed May 11, 2005 6:52 pm

I have been using the demo and I love it. It is the system that works best for me but it lacks proper latency compensation and soft takeover.
I have got a hack that just about gets by the soft takeover problem. It uses Midi-OX and VBScript. The pitfall is it makes the controllers lag a little and it is far too slow for pitch bend to work with it. If someone could translate it to C++ or Visual Basic then it will run far faster but I have neither environment.

Anyway, installation procedure:
MIDI-OX is required.
You will need MIDI-YOKE or something else
Copy the coming script into a .vbs file of your choice in the equivilent of C:\Program Files\MIDIOX\WSH
Double click it.
Choose your MIDI devices:
Player input should be the keyboard or whatever. It could be a bunch of things all channelled into one YOKE output if you want. This input should be disabled in LIVE.
Choose a Yoke In. This is the remote data from LIVE. Its partner out device should be choosen as the remote output. Again this input needs to be disabled in LIVE.
Choose a Yoke Out. This is the data that will act as the remote. The equililent input should be enabled in LIVE as a remote.
From here everything should act normally (I hope!) Press Send Updates in the preferences to make sure everything is selected.

Shebb
Posts: 16
Joined: Wed May 11, 2005 3:44 pm

The .vbs file

Post by Shebb » Wed May 11, 2005 6:53 pm

Option explicit

dim mox
dim str, strWrk, choice
dim n, ii, nInst, id
dim bGo
Dim pin, rin, rout
Dim catch

'1st: the channel, to save time it is 255 and will record the first part as well as the channel
'2nd: the control number
'3rd: 0: is on or off
' 1: the value
' 2: the timecode
Dim ctrl(255, 127, 2) '
Dim prev(127) '

' Create object
Set mox = WScript.CreateObject("Midiox.MoxScript.1", "Sink_")


' *** System devices
str = "Sys MIDI In Devices: " & mox.SysMidiInCount & vbCrLf
strWrk = mox.GetFirstSysMidiInDev

Do while strWrk <> ""
id = mox.GetInPortID( strWrk )
str = str & vbCrLf & CStr( id ) & ") " & strWrk
strWrk = mox.GetNextSysMidiInDev
Loop

' *** MIDI-OX devices
str = str & vbCrLf & vbCrLf & "Open MIDI In Devices: " & mox.OpenMidiInCount & vbCrLf
strWrk = mox.GetFirstOpenMidiInDev

Do while strWrk <> ""
id = mox.GetInPortID( strWrk )
str = str & vbCrLf & CStr( id ) & ") " & strWrk
strWrk = mox.GetNextOpenMidiInDev
Loop

choice = InputBox(str, "Player Input", "")
pin = CInt(choice)-1

choice = InputBox(str, "Remote Input", "")
rin = CInt(choice)-1


str = "Sys MIDI Out Devices: " & mox.SysMidiOutCount & vbCrLf
strWrk = mox.GetFirstSysMidiOutDev

Do while strWrk <> ""
id = mox.GetOutPortID( strWrk )
str = str & vbCrLf & CStr( id ) & ") " & strWrk
strWrk = mox.GetNextSysMidiOutDev
Loop

str = str & vbCrLf & vbCrLf & "Open MIDI Out Devices: " & mox.OpenMidiOutCount & vbCrLf
strWrk = mox.GetFirstOpenMidiOutDev

Do while strWrk <> ""
id = mox.GetOutPortID( strWrk )
str = str & vbCrLf & CStr( id ) & ") " & strWrk
strWrk = mox.GetNextOpenMidiOutDev
Loop

choice = InputBox(str, "Remote Output", "")
rout = CInt(choice) '-1 ' does not require -1 here. I am not sure why

choice = InputBox("Catch value", "Catch", "8")
catch = CInt(choice)

If vbYes = MsgBox( "Divert MIDI Input?", vbYesNo + vbQuestion, "MIDI Notes" ) Then
mox.DivertMidiInput = 1
Else
mox.DivertMidiInput = 0
End If

mox.FireMidiInput = 1
MsgBox "Press OK to end MIDI Loop"
mox.FireMidiInput = 0
mox.DivertMidiInput = 0

' All done
If vbYes = MsgBox( "End Demo - Shutdown?", vbYesNo + vbQuestion, "Done" ) Then
mox.ShutdownAtEnd = True
Else
mox.ShutdownAtEnd = False
End If

Set str = nothing
Set strWrk = nothing
Set mox = nothing

Dim valm

' Exit Point
'------------------------------------------

Sub Sink_MidiInput( ts, port, stat, dat1, dat2)

' reference and update map if we recieve info from the remote
If port = rin Then
ctrl(stat, dat1, 0) = 1
ctrl(stat, dat1, 1) = dat2
ctrl(stat, dat1, 2) = ts
End If

'info from the control. try to pass it to the remote
If port = pin Then
' Only process if CC
If Int(stat/16) = 11 Then
' only process control if it has been referenced
If ctrl(stat, dat1, 0) = 1 Then
' if time difference is small just dump the midi through
' this avoids the catch system failing
If (ts - ctrl(stat, dat1, 2) ) <= 100 Then
mox.OutputMidiMsg rout, stat, dat1, dat2
Else
valm = ctrl(stat, dat1, 1) ' remote's value for control
' catch it around a value.
' too big and there may be a jerk on the takeover.
' too small and the takeover may miss it
If valm >= dat2-catch And valm <= dat2+catch Then
mox.OutputMidiMsg rout, stat, dat1, dat2
End If
End If

Else ' if control is not referenced then dump it through
mox.OutputMidiMsg rout, stat, dat1, dat2
End If
Else ' if not CC
mox.OutputMidiMsg rout, stat, dat1, dat2
End If
End If

End Sub

'------------------------------------------
' connection point sink for SysEx

Sub Sink_SysExInput( strSysEx )
mox.SendSysExString strSysEx
End Sub

'------------------------------------------

Sub Sink_OnTerminateMidiInput()
MsgBox "MIDI Input Termination Received From MIDI-OX"
mox.FireMidiInput = 0
mox.DivertMidiInput = 0
End Sub

Shebb
Posts: 16
Joined: Wed May 11, 2005 3:44 pm

Post by Shebb » Wed May 11, 2005 6:55 pm

As I mentioned before, this should run way faster if VB or C++ is used. There is some instructions on getting this running on the MIDI-OX site if anyone has one of these things.

MrYellow
Posts: 1887
Joined: Mon Dec 15, 2003 7:10 am
Contact:

Post by MrYellow » Thu May 12, 2005 4:25 am

What's soft takeover exactly?

I'm copying it into VB for you, but need to know what the concept is. :-)

-Ben

dirtystudios
Posts: 1196
Joined: Wed Jul 10, 2002 1:28 am

Post by dirtystudios » Thu May 12, 2005 6:00 am

MrYellow wrote:What's soft takeover exactly?

I'm copying it into VB for you, but need to know what the concept is. :-)

-Ben
Let's say you assign a knob to parameter A and set it to a level of 40, then you reassign that knob to paramter B and set it to 110. If you reassign the knob back to parameter A and move it without soft takeover, the parameter will jump to 110 before it starts to change. If you do this with soft takeover, the parameter won't change when you move the knob until the knob reaches 40 and then the parameter will begin to change. It's basically a way to avoids sudden paramter jumps.

k

MrYellow
Posts: 1887
Joined: Mon Dec 15, 2003 7:10 am
Contact:

Post by MrYellow » Thu May 12, 2005 6:06 am

Nice....

Well.... It seems to be working ok with minimal adjustment, but I'll go over
it more in a few hours time and clean it up.

edit: "working ok" means it runs... but untested....

-Ben

Shebb
Posts: 16
Joined: Wed May 11, 2005 3:44 pm

Post by Shebb » Thu May 12, 2005 9:18 am

Thanks for the help!

The pitch bend info needs to be added. I did not do that since it was way too slow. it will act a little differently than a CC since the value for it is split over two numbers.

Post Reply