SuperCollider 4: First Thoughts

I don’t see myself programming with anything similar to PD. But the integration with graphics is something I would really much want. I think something like how APL plots their arrays, or jupyter notebooks plot graphs, or even musical scores if you import abjad. Something that doesn’t require one to waste time coding a custom GUI, but something that is part of the workflow.

The server node tree visualization in SC, for example, is very raw. It could provide more, and incorporate annotation by default, for example.

Even for debugging and optimization of short code blocks, it would be useful. For example:

https://dennis.felsing.org/ghc-vis/

Those Nuklear / egui widgets could as well be small TUI applications in a tmux session maybe. Functioning as a from SC decoupled GUI which communicates with sclang using OSC.

Yes, I thought about creating a small application with its GUI. What did you think, a multi-client setup or just OSC communication with sclang?

multi-client setups need a bit more care, because the state of the server, and possibly other things, needs to be accessible both ways always.

(sorry, maybe this conversation is off-topic and should be moved already :slight_smile: )

One client (sclang), one server (scsynth), multiple GUI widgets talking to sclang.

That’s quite possible, and I believe there won’t be any relevant penalty regarding latency.

1 Like

First tests with classical digital filters and Dear ImGui interface, all pure haskell, works fine and dandy.

The sound doesn’t use supercollider, because it’s simple enough. But integration with supernova will have to happen of course.

Eventually, that will surpass SuperCollider 4 (that’s actually SC5) with the power of lambda calculus and God, of better yet, Alonzo Church!! :joy: :joy: :joy: :joy: :joy:

1 Like

Shenzhen (China) is 70% less expensive than New York and is doing more advanced engineering work today than anywhere else. New York is pure decadence (I consider myself a bit New Yorker so don’t be offended there). Would be interesting to know more about how free software happens there. I’ve been told that among companies, they share a lot (and probably use another term, of course). Let’s expand our community, which is international already.

This is true, we will never just “replace” sclang. We might create new things, borrow sclang ideas, etc. Changing syntax is not the end of the world. It’s life.

I just disagree with comparing it to Lua, which is a very poor language. The author himself is very humble about what the language is (he is from Brazil. I’ve seen a few interviews/talks), and he is always talking about Haskell, he wanted to write a research and feature-rich instead, deep down.

Lua is a very simple language, but I wouldn’t call it poor. I find it rather elegant. The C API in particular is ingenious.

1 Like

You are a person who can convince me to take a better look. Don’t do it, please! :laughing:

I’m sure there are good things about it. It’s supported by a university, many good people put work there.

I just can’t compare with sclang.

There was a music system written in Lua for music synthesis, it was called Silencio (but soon the author had to use more and more javascript). He eventually dropped Lua and created a web-based environment.

Sure, but this does not make a language poor. If you make such strong statements, you’d better back it up with some hard facts.

Sorry, I didn’t mean “bad”,
I was with Sclang in mind, and I imagine the strong aspects of Lua are not related to those things.
But I’m aware of its better features too. I know it dominates video game development, for example.

Was it mentioned in this thread because of the superior GC? That was it, right?

I remember that the author of Silencio believed at the beginning he could implement a system just with LuaJIT, without \outcsound or sc or anything, Just LuaJIT → AudioOutput. It seems nothing happened as planned, since Csound and javascript took over the source code.

You probably can explain why it didn’t work. My guess is 1) speed does not really match C (which the author believed I think), and 2)Lua is dynamically typed, and does not have great runtime error handling breaking robustness, in contrast to the host languages. 3) no parallelism (not relevant, but can be a limitation)

BTW, I found this the other day… pd-hs/src/Sound/Pd/OpenAL.hs at master · lukexi/pd-hs · GitHub
Would be so cool to have libscsynth integrated like this. Is it in your foreseeable plans fo fix libscsynth or not timeline?

I wish I had the time, but unfortunately I do not :frowning:

1 Like

Shenzhen (China) is 70% less expensive than New York and is doing more advanced engineering work today than anywhere else.

I’m not sure a mechanical, or electrical, engineer would be the most useful person for the project…

E. European, S. Mediterranean and S. American countries are probably better places to look. Parts of the ME too where people often speak decent English, and are used to working with English speaking companies.

I’ve noticed a lot of Russians talking about a lot of cutting-edge stuff in programming as well.

South America has places where education is exceptionally good. One problem with software engineers ( we have BOTH computer science AND computer engineer in the same universities… ahahha) is they often leave the country early in their career. I don’t know how many come back or what. Which does not help much. It fluctuates a lot depending of the economic situation etc.

I would visit Shenzhen to learn more about the place.

He says why in the repo:

The original version of Silencio is written in the Lua programming language, and runs best on Mike Pall’s marvelous LuaJIT/FFI. The current version of Silencio is written in portable JavaScript because that makes more capabilities (audio, MIDI, animated 3-dimensional graphics, video, proper mathematics typesetting, symbolic mathematics, etc., etc.) available to Csound than any other programming environment.

He uses CSound for all his work, so I seriously doubt audio performance was a concern for him. LUA has decent performance (or ridiculous performance if you use the JIT version, though that’s no longer maintained).

There has been a longer hiatus a few years ago, but Mike Pall is still actively maintaining it (again): GitHub - LuaJIT/LuaJIT: Mirror of the LuaJIT git repository. The bigger problem is that LuaJIT will probably always be stuck at Lua 5.1 (with some bits from 5.2).

For those who don’t know: in Lua minor versions are actually different language versions with breaking changes. Lua is typically embedded into applications and people just pick the version they like. Unlike other programming languages there is no pressure to upgrade. Also, there is no big ecosystem like with Python or JS. (Luarocks has ~5000 packages with ~200,000 daily downloads; in comparison, PyPI has ~524,000 packages with ~1.5 billion (!) daily downloads.)

1 Like

This is a bit of a dead horse I trot out from time to time, but… the most core, important functionality in sclang is built on top of a VERY feature rich language with a handful of very specific syntax choices.

In it’s time it was a monumental achievement. 20 years later it’s looking very dated. Not surprising because those 20 years turned out to be the richest period for programming language innovation ever.

The SynthDef DSL, the pattern and event systems, array operations, functional programming techniques like composition, heavy use of lambdas / closures, predictable-pause garbage collection - ALL require this feature set.

Disagree. Some of these things are done poorly in SuperCollider (lambdas/closures, ‘macros’, patterns), and there’s much better support for them in other languages. There’s nothing terribly unique about SCs events (and they’re easy enough to implement in languages that don’t offer them).

Predictable pause garbage collection hasn’t been relevant for scheduling in a long time. Even in audio programming you can push the CPU surprisingly far before it becomes a problem on platforms like the JVM. Realistically any modern computer is fast enough that this will not be a problem, unless you’re doing something very weird.

Array operation is the only one, and while it’s nice, it’s hardly essential.

In contrast these are the things that SC_Lang doesn’t have. A good macro system. Dynamic compilation. Good functional syntax and libraries. Namespaces (my god, namespaces). Support for decent abstractions (Haskell). Good multi-tasking/synchronization/parallization primitives. Good error handling.

It also doesn’t have access to a large library ecosystem, so it’s missing out on robust libraries for all kinds of stuff (immutable data libraries, powerful libraries for list/array processing, network stuff, access to C/C++ libraries through CFFIs, true multi-threading, parser libraries).

There are no other mainstream languages that have the right features to enable these things - at best, you’ll get about 75% of the right things and with more frustrating syntax.

As someone who mostly programs in other languages I find SuperCollider’s syntax pretty frustrating and verbose, so to some degree this is a matter of taste. I really hate how functions are handled in SuperCollider, and I think the pattern libraries syntax is kind of a hack. It’s also not a hugely consistent language in ways that I find frustrating. It reminds me, obliquely, of JavaScript. Better than it seems on the surface, but far from perfect.

I use the Common Lisp front end and it does more than SCLang, and in my opinion better (the pattern library is more consistent and logical, I have more flexibility when defining synths and the LISP libraries offer a lot of functionality that I miss in SCLang). It also allows me to recompile classes without restarting my environment, and it has really nice error handling. On top of that I was able to write my own minilanguages for notation and Tidal stuff very easily.

The Haskell front end is similarly complete, and I have no doubt that one could write front ends in other languages that were similar. Most of what SCLang offers is baked into most languages - the layer that provides access to the server is surprisingly thin.

As much as sclang is a hot mess (it definitely is), the nearest contender in terms of functionality is Lua

This is simply not true. Not even close to being true.

I’d say that the closest language in spirit to SCLang that offers similar (well more, really) functionality is Elixir. A weakly typed functional language, inspired by Ruby, that runs on the BEAM JVM and which has a very good macro library. Really, what’s not to love :slight_smile: Actors are first class and baked into the language, and it has a very sweet FFI.

Sad fact is: the options are either commit to sclang, or rewrite portions of the class library in another language with the knowledge that you’d be trading up on tooling/support/documentation/etc.

I think there are three arguments in favor of SCLang:

  1. Legacy: There’s a lot of code written in it.
  2. Coherence: The community are (mostly) talking in the same language, the teaching resources all speak the same language. SuperCollider is a small community, further fragmentation is bad.
  3. New Users: It’s good that you can point new users to a single IDE/language, and SuperCollider is pretty quick to get up and running and making a sound. And when they look for help, it’s all going to be relevant to them.

There are three arguments against it:

  1. It’s set in aspic: It takes a huge amount of developer man hours to improve and maintain a language, and that just doesn’t exist for sc_lang (plus language design is really hard). The SCLang of today (JIT, syntax, all of it) will be the SCLang of tomorrow. As time goes on it will seem more and more dated, and more alienating to users (the CSound problem).
  2. Libraries: The community is too small and focused to create high quality libraries for things that people take for granted today. For better, or worse, if its not in the language then you’re not going to get a reliable library for it.
  3. Performance: SCLang is already a slow language, and has the state of the art develops it will be (relative to other languages) an even slower one.

I don’t know there’s really a solution to this other than the entire community commiting to a new language (Elixir - come on people, you know you want to), which I think is very unlikely to happen. So I suspect what will happen is the same as today. People like myself who get frustrated move to a different language, and thus fragment the ecosystem. Some new people bounce because they dislike the language, never realizing that there are alternatives. And people who continue to use the language grumble more and more that it doesn’t do the things that they take for granted in other languages.

1 Like