Does anyone use other JVM languages?

Thomas Royal's icon

I've been looking for interesting ways of scripting Ableton live for a while, and I recently revisited the mxj object. I've been away from the Java ecosystem a bit, but I wondered if one could create a Kotlin external. I used IDEA, community edition.

import com.cycling74.max.*
class sanity2(args: Array<Atom?>?) : MaxObject() {
init {
declareInlets(intArrayOf(DataTypes.ALL))
declareOutlets(intArrayOf(DataTypes.ALL))
createInfoOutlet(false)
}
override fun bang() {
outlet(0, "sanity")
}
}

Image below, for what it's worth. YMMV.

nick rothwell | project cassiel's icon

Many years ago (at least 12) I built live-coding wrappers around the JVM for Groovy, Python and Clojure. Have a look under https://github.com/cassiel for any repos starting with ”net.loadbang”.

Iain Duncan's icon

Hi Thomas, you could checked out my Scheme for Max project. It lets you script Max and live in S7 Scheme, which is actually remarkably close to Clojure (closer than either pure scheme or pure Common Lisp actually). s7 also has the interesting advantage of being the same dialect used in Common Music 3 and Snd, thus providing a rich source of code to look at. It does not require the JVM as the intepreter is implemented in pure C, so it's a drop in Max external.

I have youtube examples, including of scripting Live up on the channel:
https://www.youtube.com/watch?v=j0sKBA-Pv2c&ab_channel=MusicwithLisp

Project page with links to docs and tutorials is here:
https://github.com/iainctduncan/scheme-for-max

I am planning a release in the next year that will also play well with the Bach project.

nick rothwell | project cassiel's icon

+1 for Scheme for Max, and one day I’ll actually have time to play with it properly.

Regarding Clojure, the ClojureScript variant cross-compiles to Javascript so can be run inside Node.js in Max (complete with network REPL, hot file reloading etc.). Getting it going in JS/JSUI is within arm’s reach but knobbled by the ancient JS engine used by those objects.

Iain Duncan's icon

Thanks Nick! I also managed to get Nick's Clojurescript approach working in Node but gave up on trying to do so in Max. But then... that led to discovering s7 so it was a good gateway drug! :-)

Thomas Royal's icon

I definitely have a tab open for s4m. I was even inspired by the part of the code that handles scheduling priority when I was working on my max port for Fabrice Ballard's QuickJS. (Sadly, I lost interest in the QuickJS project.) Thanks Iain.

Iain Duncan's icon

Glad to hear it's interesting to you. I'm always happy to help out with questions or anything, either here or on the github discussion boards.