Why use other languages?

Based on discussion on the SC4 thread, the some observation thread and generally a few different discussions I’ve seen here and my own curiosity, I was wondering if people could share why they use other languages with the SC server.

I’m a musician who has never programmed outside of sclang (I have dabbled, a very very very small amount in Nannou). I find Supercollider to be mindblowingly awesome but because I don’t know what I don’t know I never really understand what I’m missing out on. So, just out of curiosity, maybe people could share their reasons for using languages other than sclang?


1 Like

I think it is just healthy discussion. SC is awesome. But there have been a ton of languages developed over the past 20 years since sc3 was made, so it is good to talk about these things.

I was thinking to answer something like that. For what I read, it seems to generate some anxiety. sclang is not going to be deprecated, to have an environment with an IDE, builtin documentation, gui and workflows is something good for most(/normal) people by far. It happens that many users are also hardcore developers :slight_smile: and most reasons are rather technical discussions.

My reason was very specific: I was building a software loop pedal in sclang and the code had grown to a size where I kept running into bugs that were super hard to track down. In the rest of my programming life I primarily use Haskell, which is great both for finding and more importantly preventing bugs. For large pieces of code it was much easier for me to, as the saying goes, obviously have no bugs as opposed to not having any obvious bugs. I switched to Haskell for music years ago and never looked back – it’s been a joy!

I’ll also say that the flip side of having purpose-built tools like the SC IDE is that the community has to develop and maintain it all. Even a relatively small language like Haskell has had person-decades devoted to aspects of tooling that SC devs have had much less bandwidth for.

My use of Scala has two origins. First, I found it very cumbersome to programme more complex things in sclang as soon as classes were involved, it’s just very hard to debug and you get almost no help from the editor (back then not even scide existed), you can’t navigate or refactor anything, like go to a symbol, rename a symbol; or halt at a breakpoint. Before I had worked with Java, so I knew NetBeans and Eclipse and what kind of experience those enable for developing code. Scala was relatively young at the time (I think it was before version 2.8 came out), so even the first version of ScalaCollider looked a lot less elegant than the one of today.

The second origin was that my PhD research was on observing compositional process, and I wanted to create an environment that could represent that process in the form of a kind of bitemporal database, the eventual outcome of which was the framework SoundProcesses (based on ScalaCollider), and as UI front-end Mellite. Each of these is a huge system which I would argue could never be written directly in sclang. An early prototype (Bosque) was written in SC, but soon had already a Java-based UI via OSC. So at a point, I gave up sclang entirely. There are many other aspects that made it annoying to work with sclang, such as a lack of running multiple threads in parallel, and the speed of sclang is quite bad as soon as you need to handle larger collections of objects.

What I like about Scala is that the language is very expressive and concise, and in general doesn’t get in your way. The boiler-plate is minimal, while the type system is very rich and can represent the structures I was dealing with (for example, abstracting different memory models for storing sound objects). In Mellite you write little snippets for real-time sound (based on ScalaCollider), for offline DSP (FScape), and for control structures (Ex/Control - to me always feels like a text-based version of PD). Those use embedded DSLs, that’s still Scala but tweaked to make it straight forward to express the domain specific tasks. And as “user-facing” it almost feels like a dynamic language, much more like Python than Java, for example.

Often I would write my sound installations “directly” in Scala using the above systems as libraries, and I often grap libraries written by other people (for certain algorithms, or file formats, or image processing, you name it), and there is a ton available for the JVM. SC was always an island, unless you can write C extensions to link into the language - and who wants to do that when writing a piece? - you can only use other libraries by calling, for example, shell programs or setting up an OSC interface with other software. Being able to directly use all kinds of libraries was a big plus when switching to JVM / Scala.

A big disadvantage of Mellite is in fact that its mini-IDE features are far away from what IntelliJ IDEA provides. In a way, it’s the same problem that scide has, it simply cannot compete with a fully-fledged IDE. So in many cases that doesn’t matter, but sometimes it is just much more convenient to write in Scala directly. I hope that the gap can be closed a bit by using the Metals language-server for Scala at some point, and I’m also contemplating whether it would be feasible to embed NeoVim instead (and thus get a very good editor “almost for free”).

1 Like