Home Archives Search Feed About About


Using Opusmodus with QuickLisp

In my scant free time, I have begun playing with Common Lisp again. It’s been 10-15 years since I last spent any time with it. I recently discovered a program called Opusmodus that uses Common Lisp at its core. It provides a music composition interface using Common Lisp to enable composers to programmatically score their compositions.

Opusmodus wasn’t explicitly designed for programmers though there are a number of programmers that use it from what I can tell. If you have written any Common Lisp in recent history, QuickLisp is a natural tool to use as part of the development cycle. Unfortunately, Opusmodus’s bundled version of Clozure CL (called ccl later) is stripped of the development interfaces so some packages will not compile correctly with (ql:quickload "...").

If you go hunting around for instructions on how to install QuickLisp properly with Opusmodus, there’s a few references on the forums but they’re at least a couple years old. Here’s a quick set of steps to get QuickLisp installed and loaded automatically. It’s broken into updating ccl and then what changes are necessary in Opusmodus.

Updating ccl

Note: Update any instances of <user> with your own user’s name.

  1. Pick a directory where you’d like to have the full ccl installed. A good place would be /Users/<user>/ccl/.
  2. Fetch the sources from git: git clone https://github.com/Clozure/ccl.git /Users/<user>/ccl
  3. Fetch the bootstrapping binaries: curl -L -O https://github.com/Clozure/ccl/releases/download/v1.12-dev.5/darwinx86.tar.gz
    • Note: At the time that I wrote this, Opusmodus was using ccl v1.12-dev.5 which is why the bootstrapping binaries above reference that specific release.
  4. Change directory into the ccl sources: cd /Users/<user>/ccl
  5. Unpack the bootstrapping binaries into the sources directory: tar xf ../darwinx86.tar.gz
  6. Launch ccl: ./Users/<user>/ccl/dx86cl64
  7. Now rebuild ccl: (rebuild-ccl :full t)

If all went well, you should see a lot of output about Loading …” and then at the end:

;Wrote bootstrapping image: #P"/Users/zbrown/Code/lisp/ccl-dev/x86-boot64.image"
;Building lisp-kernel ...
;Kernel built successfully.
;Wrote heap image: #P"/Users/zbrown/Code/lisp/ccl-dev/dx86cl64.image"

Configuring Opusmodus to Load QuickLisp

The default location for Opusmodus to install extensions is in /Users/<user>/Opusmodus/Extensions. Opusmodus v1.3 includes a QuickLisp Start.lisp in the extension directory with a lot of what you need to get started.

There’s a couple of specific things you need to update though to get it working:

  1. First, the entirety of the QuickLisp Start.lisp is block/multiline commented out. If you’re not familiar with the Common Lisp multilane comments, they open with #| and close with |#. In my installation of Opusmodus, the entire file was commented out.
  2. Second, you need to tell Opusmodus to use your own version of ccl instead of the bundled version of ccl. Beneath the line (in-package :Opusmodus), add this line (update the <user>): (setf (logical-pathname-translations "ccl") '((#P"ccl:**;*.*" #P"/Users/<user>/ccl/**/*.*")))
    • This updates the path that Opusmodus looks for ccl.
  3. Next we need to uncomment the lines that load QuickLisp and install it. They look like the following:
    • (load "http://beta.quicklisp.org/quicklisp.lisp")
    • (quicklisp-quickstart:install)

Once you’ve finished up the two sections above, you can launch Opusmodus and it should load QuickLisp. To test this, select the Listener window and install a package: (ql:quickload "cl-json"). If all goes well, you should see something like:

Welcome to Opusmodus Version 1.3 (r24952)
Copyright © MMXIX Opusmodus™ Ltd. All rights reserved.
? (ql:quickload "cl-json")
To load "cl-json":
  Load 1 ASDF system:
    cl-json
; Loading "cl-json"

("cl-json")
? 

In my case, I already had cl-json installed so nothing was downloaded.

The end

That’s it. Nothing else to describe.

Posted on August 18, 2019   #music     #howto     #lisp  






← Next post    ·    Previous post →