lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)!...

49
lubyk lua libraries for live arts Gaspard Bucher (Buma) artist, musician, coder

Transcript of lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)!...

Page 1: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lubyklua libraries for live arts

Gaspard Bucher (Buma)!artist, musician, coder

Page 2: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lubyk

is not a framework

Page 3: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 4: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 5: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Why lubyk ?• Reuse code from project to project • Accelerate development (live coding) • Simple APIs • Good documentation • Stability (unit tests)

Page 6: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

History !• 2006 First prototype in Ruby

• Slow, inaccurate, rubato music • 2008 Second pure C++ version, many threads,

mutex. Lua scripting. Works when not crashing

Page 7: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

2008 “Home” machine learning based movement recognition

Page 8: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

History !• 2006 First prototype in Ruby

• Slow, inaccurate, rubato music • 2008 Second pure C++ version, many threads,

mutex. Lua scripting. Works when not crashing • 2011 Third version, pure lua, Qt GUI, multi-process,

network distribution (mdns, zeroMQ, Msgpack).

Page 9: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

2011 “boats to nowhere”

Page 10: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

2011 All written in lua (dub made Qt bindings)

Page 11: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

What was wrong ?• Did not scale well to larger projects • Confusing interface • Hard to work on different parts (shaders, physics,

control, music integration, etc). • Too complex, hard to share modules • Complicated GUI takes too much dev time !!

Page 12: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

less is more

Page 13: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

History !• 2006 First prototype in Ruby

• Slow, inaccurate, rubato music • 2008 Second pure C++ version, many threads,

mutex. Lua scripting. Works when not crashing • 2011 Third version, pure lua, Qt GUI, multi-process,

network distribution (mdns, zeroMQ, Msgpack). • 2014 Fourth version, modules, tests, doc

Page 14: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Modules

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 15: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lub• Class declaration • Template {{moustache}} • Directory traversal • Algorithm (search) • String, Array helpers • etc

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 16: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Documentation, testing• Inline documentation • Literate programming • Testing framework • Coverage • Module setup/build

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 17: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lut.DocCross references

Latex Math

Page 18: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lut.Doc!literate programming

Page 19: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lut.Doc!literate programming

Page 20: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Testing with lut.Test

Page 21: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Libraries using lut

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 22: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

lens• Scheduling • Socket (TCP, UDP) • Thread • Timer • FileWatch

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 23: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

encode / decode

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 24: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Core graphic types

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 25: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

bulletphysics (3D physics)

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

• lug integration

Page 26: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

media (video, image)

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

• Native (AVFoundation) • Fast, asynchronous • Multi-threaded

Page 27: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

OpenGL 4

• Shaders • Geometry • Etc

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 28: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Native UI• Provides OpenGL context • Event loop integration

with lens • View (window/view) • Mouse, keyboard

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 29: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

midi• Midi in/out • Virtual ports, real ports • Note handling (off event)

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 30: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

C++ binding generator

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

• Advanced type management • GC protection • Fast callbacks from C • Cast, operators, etc • Customizable • Uses doxygen

Page 31: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Libraries using dub

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 32: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

OS Support

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 33: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Windowsalpha

beta

released

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 34: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Linuxalpha

beta

released

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

Page 35: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Mac OS X

lub

lens

lui

four

yaml

lmidi

xmllug osc

lut dubbtmedia

• media = 10.9

alpha

beta

released

Page 36: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Future plans• Simple multi-machine, multi-process support

(mdns + zmq + dropbox) • Parameter support (per effect, per object, etc).

Makes code reuse and adaptation easy. • Eventually, use a simple web app for this. • Exploration needed, ideas welcome !

Page 37: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

Immediate plans• Finish Linux port, start Windows port, for fun RPi • Extract lug from four and optimize data transfers • Fix old lubyk libraries

• mdns (Zeroconf plug&play network) • zmq (ZeroMQ messaging library) • box2D (2D physics)

• Parameter handling • Workshops !

Page 38: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from

using lubyk• Stable modules: luarocks install … • Licence: MIT • Documentation: doc.lubyk.org • Source code: github.com/lubyk • Twitter: @lubyk_

Page 39: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 40: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 41: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 42: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 43: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 44: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 45: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 46: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 47: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 48: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from
Page 49: lubyk - The Programming Language Lua · lubyk lua libraries for live arts Gaspard Bucher (Buma)! artist, musician, coder. lubyk is not a framework. Why lubyk ? • Reuse code from