v 0.8
Brad Garton, July 2004
Mac OSX; Max/MSP v 4.3 or 4.5 only
NOTE: The
[maxlispj]
object is more robust, and it also runs on Windows XP machines as well
as both Intel and PPC Macs. I recommend using it instead
of the older [maxlisp] object here.
download maxlisp
CLISP
is a GNU implementation of
Common Lisp,
a widely-used version of the ancient and venerable LISP programming langauge.
The
[maxlisp]
object completely encapsulates
CLISP
within the
Max/MSP
real-time music environment, extending the capabilities of Max/MSP in
the following ways:
This function can be used to build a function returning a list of three
random elements from three different lists:
(defun get3el(l1 l2 l3)
(cons (getel l1)
(cons (getel l2)
(list (getel l3))))
)
And the delightfully insane thing about LISP is that lists
can be lists of numbers,
lists of strings, lists of functions, lists of lists, etc.
A fairly common complaint among Max/MSP developers is the lack
of a robust set of string-manipulation utilities.
Obviously, LISP has powerful string-processing capabilities.
Full source for both the [maxlisp] object and the
modified CLISP are available for downloading (see below).
Potential "Pitfalls"
 (we wouldn't want to call them "bugs", would we?)
- Because the CLISP imbedded in
[maxlisp] has no direct communication with you as you write LISP
code, the debugger has been disabled. If a break condition occurs
that invokes the debugger, the LISP interpreter will crash along with
Max/MSP.
The Good News is that you can develop your LISP code in 'native' CLISP and
(in most cases) import it directly into [maxlisp]
without any modification. CLISP has a full-featured
Common Lisp debugging environment.
There are a variety of ways for
sending LISP into the [maxlisp] object, including loading
from files into internal scripts/buffers, sending as [maxlisp]
messages, sending as [text] messages (often from the
[textedit] object), etc.
- It is possible -- and in fact quite easy -- to write LISP programs
that take a significant amount of time to execute. If the LISP interpreter
takes too much time, Max/MSP will not be happy. This is real time,
right?
- The CLISP garbage-collector can also cause problems, although
primarily in loading larger programs. I have altered the gc behavior,
but if it is called within a series of function definitions (for example),
it will probably crash from timing or break conditions. See the
"riff-o-matic" example patch for an approach to loading a larger
LISP file into [maxlisp], with top-level calls to (gc).
- I'm not sure how well [maxlisp] will handle a REALLY
LARGE program. "riff-o-matic" is somewhat substantial, but I'm not
a truly sophisticated LISP hacker.
- I have had a few reports that when the [maxlisp]
object is instantiated, the system goes into the "spinning disk of death"
mode as CLISP attempts to allocate the memory it needs. I have been unable
to reproduce this on any of our machines at the CMC (10.2.x and 10.3.x),
but I can imagine that this is a Real Live bug. However, it's sort of
hard for me to find the problem... Hopefully this won't happen to you.
In the FUTURE I will probably use the new mach-o external
support for integrating the CLISP code into [maxlisp]. I suspect
that this may solve this problem (and clear up some of the (gc) issues
as well).
- There presently is an issue with semicolons... these are used for
comments in Common Lisp, but they function as a 'message' character
for Max/MSP. Your results will vary, but to be safe you should probably
strip semicolon comments from any LISP code coming into Max/MSP.
Download and Install
- maxlisp.sit
  (1.1 Mbytes download/3.8 Mbytes on disk)
v 0.8 -- 7/25/2004
This archive will unpack into a single maxlisp folder. You will need
to place it somewhere in the Max/MSP search path -- I recommend putting
it in
/Library/Application Support/Cycling '74
or
/Library/Application Support/Cycling '74/externals
[NOTE: Be sure to remove any previously-existing
maxlisp folders in the Max/MSP search path]
- maxlisp-help.sit
  (.1 Mbytes download/.2 Mbytes on disk)
v 0.8 -- 7/25/2004
The folder maxlisp-help will unpack from this archive. Place it
in the Max/MSP help folder, usually the folder
/Applications/MaxMSP 4.3/max-help.
Inside this folder is the patcher maxlisp.help, which contains
a number of
[maxlisp]
examples and associated documentation. Run them all, they're fun!
Source Code
- maxlisp-src.sit
  (.14 Mbytes download/1.1 Mbytes on disk)
v 0.8 -- 7/25/2004
The source code and CodeWarrior project files for the
[maxlisp]
object.
- clisp2.32-src-maxmspfiles.sit
  (.2 Mbytes download/124 Mbytes on disk [total CLISP])
This archive contains the .c files I have changed from the standard
CLISP
distribution (I worked from v2.32). If you want to compile CLISP
for use in Max/MSP, download the v2.32 package, configure and build
it for Mac OSX (you will need the lispinit.mem image that
you will create from this). Then unpack the files in this archive and
copy them into the clisp-2.32/src directory. After this, in the
clisp-2.32/src, type "make maxlisp.so" and the shared library
maxlisp.so should be created.
You will need to copy the file lispinit.mem into the
maxlisp/maxlisp-bundle directory, and the maxlisp.so
file will need to be placed into the
maxlisp/maxlisp-bundle/Contents/MacOS directory.
- maxlisp-src.tar
  (1.16 Mbytes download/1.5 Mbytes on disk)
v 0.8 -- 7/25/2004
The modified CLISP source files and maxlisp.c file
(no CodeWarrior gunk) all in one handy-dandy archive.
Final Words on This Web Page
The
[maxlisp]
object was written by Brad Garton with much advice and assistance from
Dan Trueman and Luke DuBois (Dan wrote the internal buffer script-editing
code). Joshua Kit Clayton was an invaluable resource, as always. Thanks
guys!
I hope this may be useful for others; I'm
having a blast with it. Let me know what you think!
Brad Garton
brad at music dot columbia dot edu