Monday, December 7, 2009

Tut 6: Ardour Control using OSC & Python

Hey all, today a slight change of topic.
Controlling Ardour using OSC messages. Weapon of choice for this will be Python, a great interpreted Object Orientated scripting language.
This language can be used to run files (.py scripts), or from the command line.

Google for BPython if your looking for some fun experimentation with python.

OSC messages & python is quite easy. I'm on Debian linux, so a quick
browse over here and you've got all you need, follow thier instructions on building & installing. (its not hard.. but if there's problems, let me know.)

On to the fun part. I've written a small library which provides and Ardour class, on which you can call methods that control Ardour. Eg: (in BPython)


So you see all methods attached to the Ardour class, after that, its just about calling these methods using your own script. I primarily wrote this to get functionality to my Alphatrack, (which is supported by linux if you compile a kernel module).

More Examples:
ardour.Ardour():




Here shown: ardour.Ardour() 's
attribute & methods.

All OSC functions of Ardour are currently supported




So you see that its quite trivial to get ardour to react to python. All Ardours OSC functionality is provided in the current python library, who knows what the future will entail... :-D


Grab the .zip archive of the library and a Wiimote Demo from here.

For those Arduino users out there, enjoy, I plan to build a little Ardour-ino too.
All the best, -Harry

PS: I'm aware that  Sampo Savolainen did great work & added the WiiMote to ardours control surfaces, using ardour's internal control mechanisms. This is an OSC library, which allows any "Python-capable" device to interact with ardour.

3 comments:

  1. Wow, that's great. I can't wait to experiment with it.

    ReplyDelete
  2. Did you do some work on Ardour-ino?
    I have build a midi drumhead called YetAnotherArduiniMidiDrum (YAAMIDRUM) ->
    http://blog.georgmill.de/2011/03/01/yet-another-arduino-midi-drumhead/

    It would be nice to put some OSC code into it to control ardour directly with some pads of the drumset. Can you give me a hint how this is done?

    Have fun.
    Georg

    ReplyDelete
  3. Hey Chloris,

    Nope never did get around to controlling Ardour using a custom controller... Primarily as I'm not using Ardour for live work which is where my main intrest lies!

    I've never done OSC with the Arduino, but I know you'll need the ethernet shield to get the network running. After that you need to get an ethernet cable running from your Arduino to your laptop/computer.

    Then in the Arduino you'd write some code (like this):
    http://arduino.cc/blog/category/protocol/osc/

    And set up you comp to accept midi, click "Use OSC" in Ardour... and it should all work... (That's "Native" OSC from the arduino.

    Using this library, its a little easier:
    Send a serial message to the computer, get python to connect to where that message is arriving:
    serialConnection = serial.Serial("/dev/ttyUSB0")

    And then some code like so:
    if (charOnSerial = "p"):
    ardour.play()
    if (charOnSerial = "s"):
    ardour.stop()

    where "p" and "s" are strings you send down your serial connection in the arduino using the standard Serial.printstr()!

    Hope that's of help! Let me know if you get something going!
    Cheers, -Harry

    ReplyDelete