[maxmsp] [ANN] lua~
Graham Wakefield
lists at grahamwakefield.net
Fri Oct 26 11:43:52 MDT 2007
- Previous message: [maxmsp] Re: Re: C++ runtime error
- Next message: [maxmsp] [ANN] lua~
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all, The lua~ external is back online: http://www.mat.ucsb.edu/%7Ewakefield/lua%7E/lua%7E.htm Lua~ is a Max/MSP external embedding the Lua language along with some DSP functions and a scheduler supporting sample-accurate function calling using coroutines. A lua~ object embedded in a Max patch can load and interpret Lua scripts that receive, transform and produce MSP signals and Max messages. Lua~ is particularly well suited to granular synthesis, algorithmic microsound and accurate timing needs, helpfully circumventing some of the limitations of the Max/MSP environment for such work by supporting highly dynamic signal processing graphs in parallel processes according to timing specifications below block rate. Using an interpreted scripting language within a graphical programming environment such as Max offers advantages of control flow, generality of data and structure, high precision and control, complexity of data and functional interdependency and variable scoping. Here's a very simple code example: -- define a function function beep(dur) -- play a decaying sine to the signal outlet for dur seconds: play(Out, dur, Sine(440) * Decay(dur)) end -- repeat forever: while true do -- launch parallel coroutine, function beep with duration 0-200 ms go(beep, math.random() * 0.2) -- wait for up to two seconds wait(math.random() * 2) end There are a few special advantages to using Lua - its memory allocator/garbage collector and general efficiency supports interpreting script code in the audio thread, which means that sample- accurate function calls and control logic are possible. Lua also supports coroutines (collaborative multithreading), kind of like deterministic threads that are very cheap to run. I've extended them to be aware of sample time, so they can be used like Routines or Tasks in SuperCollider 3, but they can embed both control logic AND synthesis graphs like SuperCollider 2, and also like shreds in ChucK. The nicest aspect: you can generate, execute, change and remove any number of any types of unit generators to the signal processing with sample accuracy, below the block-size, at run-time, within deterministic parallel execution flows. The not so nice aspect: Binding Lua to Max/MSP is much less simple than binding to Jitter, because of the underlying object model in the SDK (Jitter objects have excellent reflection, while only the most recently obexed' Max objects do). The main issue is that it is not workable to create, connect and modify MSP objects from within a script binding. Unfortunately this means that I had to write a new set of elementary unit generators rather than re-using MSP object code. I'm also in the process of binding the STK library, so a standard, familiar set of ugens and so on will be available. Currently OSX only, but maybe I can get a windows box to compile the XP version in the next few weeks. Graham www.grahamwakefield.net
- Previous message: [maxmsp] Re: Re: C++ runtime error
- Next message: [maxmsp] [ANN] lua~
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
