Version 7, last updated by hi-pi at December 12, 2008 12:10 UTC

Getting started with LiveAPI - Toolchain Setup

To get started with LiveAPI, you will need some basic tools.  I have decided not to use Eclipse, but if you choose to do so, follow this link to set it up and skip my toolchain introduction:

http://www.assembla.com/wiki/show/live-api/Setting_Up_Eclipse

I chose to use IDLE and Tortoise SVN.  This setup seems easier to me, and it does what I need it to do.  The first step is to download Python2.2.3.  There are newer versions available, but I believe some of the modules (log server) direct to the default Python22 directory, and it's just easier to install this version of Python.

The download page is at http://python.org/download/releases/2.2.3/ and Windows users can directly download an executable installer at http://python.org/ftp/python/2.2.3/Python-2.2.3.exe.  Install Python to the default C:\Python22 directory.

The next thing you will need is a means to access the SVN files.  I use Tortoise SVN because it supports SVN access via right-clicking in a folder and downloads the files right to it.  The download page is at http://tortoisesvn.net/downloads.

The next step is to get the files you want.  In order for Live to recognize the existence of a script, it must be placed in your Live program folder under Resources\MIDI Remote Scripts.  Open an explorer window and browse to this folder.  When you right-click, you will see an option for "SVN Checkout".  Select this and Tortoise will start.  The only information you will need to enter is the URL of the SVN repository.  Use http://svn2.assembla.com/svn/live-api.  At this point, you can simply click OK and select the default options, and it will download all the examples available.  Alternatively, you can click the "..." button at the top right and browse for the example you want.  If you do it this way, it will drop the folder directly into your "MIDI Remote Scripts" folder and Live will recognize it.  If you choose to download all the available files, you'll have to browse through the subdirectories and copy the needed folder back to "MIDI Remote Scripts". Once you have the files you would like to use as your starting point, you can open Live and select it as your control surface in preferences. Be sure to set the proper MIDI in/out interface and make sure they are active.

Live will allow you to edit the files while they are open. I use IDLE for editing. Right-click a .py file (.pyc are the result of Live compiling your .py file, ignore those) and choose "Edit with IDLE". The file will be open and ready for editing. Once you've made any code changes, press ctrl+s to save. Then you'll need to restart the script in Live. If you leave the preferences open and the last thing you clicked was the drop-down box for selecting your interface, you can just press the arrow keys up to select another interface, and then down again to re-select yours. Live will recompile the files and the code changes are now implemented. If Live crashes, you've most likely made a syntax error. Revert back to the previous working code before opening Live again, as it wants to default back to the same script.

The scripts I have looked at have logging built into them. There is a log server script available in the tools folder when you do your SVN checkout. I haven't yet figured out how to use this, so I'm using the text files that are outputted instead. These are available in C:\Documents and Settings\<USER NAME> as stderr.txt and stdout.txt.

There is one more tool that is necessary: the ability to code in Python. Experienced programmers will probably find that looking at the example code will be enough. Python is an easy language to learn and it reads as close to spoken English as a programming/scripting language can get. However, if you have no experience in any kind of programming, a book that has been recommended by users of the forum is called "Learning Python", published by O'Reilly. A good book about python is also Dive Into Python, you can read it online,buy it or download it as pdf.