Smalltalk SuperCollider

Smalltalk SuperCollider is a Smalltalk library for working with the SuperCollider synthesiser.

Smalltalk SuperCollider is research quality, it has minimal documentation and the current implementation is in terms of Haskell SuperCollider, which is required in addition to a Smalltalk image.

It does work though, and it may be of interest to people familiar with SuperCollider, Smalltalk and Haskell.

Smalltalk SuperCollider is at http://rd.slavepianos.org/t/stsc3

Haskell SuperCollider is at http://rd.slavepianos.org/t/hsc3

There are some short demonstration videos at http://rd.slavepianos.org/?t=stsc3&e=md/video.md

Smalltalk SuperCollider also includes an interpreter for Smalltalk programs where the only data type is the SuperCollider Unit Generator. This interpreter (called “stsc3”) can run the example graphs in the “help” sub-directories directly, without requiring a Smalltalk system.

Smalltalk SuperCollider works with Squeak, GNU Smalltalk, Pharo and Cuis. There is an Emacs mode for working with either GNU Smalltalk or the stsc3 interpreter.

It should be relatively simple to add a mechanism for communicating directly with SuperCollider, patches welcome.

Best,
Rohan

2 Likes

Thanks for this - the examples are very nice - excited to try.

Supercollider is based on smalltalk right? Out of curiosity, what is the idea behind the project Smalltalk Supercollider?

Hello. Briefly, if you do to try and set this up, and if you’re not particularly familiar with Haskell, let me know and I’ll write some instructions. It’s perhaps not obvious how to get all the pieces working. It might almost be easier to write the Smalltalk code to talk to SuperCollider language, if you know Smalltalk well? I’m not sure. You’d need a SuperCollider equivalent of the file below, Best, Rohan

https://gitlab.com/rd--/stsc3/-/blob/master/st/SC3-Haskell.st

No particular idea. Actually, there are many particular ideas but they’re all very speculative. It’s just a small experiment. I very much like Smalltalk and SuperCollider and I wanted to connect them up. Also I’ve been thinking a lot about Kyma this last year, and about persistence (as in “the continued or prolonged existence of something”, as in “Image-based persistence”). Best, Rohan

Thanks Rohan I would appreciate the instructions to get it working with Haskell if you have the time! I got as far as fileIn the indicated files in Squeak. I do sort of wish that sclang had simply been written on top of SmallTalk !

Hello,

I just learned a bit more about the new Haskell package system and actually it might be (relatively) straightforwards!

I think if you install ghc and cabal for your system (I’m on debian testing so I’d type sudo apt install ghc cabal) and then fetch hsc3-graphs from the address above you should just be able to run cabal install from the hsc3-graphs directory.

It will think about things for a little, download some more git archives, compile everything, and put the finished program somewhere slightly obscure (here it was at ~/.cabal/bin/).

(If you already fetched hsc3-graphs you’ll need to update it, ie. git pull, because I had to add an extra file for this process to work.)

Let me know if it doesn’t work for you? The process is very new to me.

Also I think it’s very nice having a simple self contained special purpose interpreter for SuperCollider!

Particularly, in 1996 I’m not sure you really wanted to be running Squeak1 on a 8100/80. (Or Squeak2 in 1998 on a G3, which I guess is the SC2 reference point.)

http://groups.google.com/g/comp.music.research/c/g2f9EcL1mUw

But yes, in the current context, Squeak looks very small and very fast!

Best,
Rohan

hey there @moderators hoping Rohan’s posts might reappear (unless this is an imposter stealing our scsynth graphs!)

I got hsc3-graphs installed - thanks!

I tried to run it from the commandline with:

hsc3-graphs fragments hs play ~/Documents/Squeak/stsc3/help/graph/jmcc-sweepy-noise.st 

but get the error

hsc3-graphs: /home/rohan/sw/hsc3/lib/hsc3-std-imports.hs: openFile: does not exist (No such file or directory)

if I try without ‘hs’ I get

hsc3-graphs command [arguments]
 db polyglot autogen
 fragments {hs} {play | draw | dump-ugens} FILE-NAME

thanks!

Hello.

Oh, apologies, that’s a fixed directory path!

I’ve made it an environment variable.

You’ll need to refetch and recompile hsc3-graphs and also get a copy of the hsc3 archive (see address above, or https://gitlab.com/rd--/hsc3).

Then you’ll need to set HSC3_DIR to point to where you put hsc3, using the syntax for your shell (here I had to write export HSC3_DIR=$HOME/sw/hsc3).

After that, you don’t need to run hsc3-graphs yourself, the Smalltalk system does it for you.

This arrangement is because I already had hsc3-graphs here, so when I was writing the Smalltalk code I made it print out a hsc3 version of the graph and then call hsc3-graphs to play it, or draw it.

It would make at least as much sense to write a SuperCollider language graph, but that’s not what I did.

So from Smalltalk you can do 'jmcc-why-supercollider.st' evalFile play or use the SC3Browser (select graph, right click for menu) and so on.

Smalltalk will write a temporary .hs file and call hsc3-graphs on it.

Best,
Rohan

Done – apparently the “system” thinks, if you create many posts linking to the same domain, then you must be spamming.

Obviously these are legit posts – they should be visible again.

hjh

Thanks Rohan getting close!

I first try playing a fragment from the command line to be sure that hsc3-graphs is working…

but get these errors (and hen many more similar)

m

/var/folders/xx/6v0ml_rn3_l0kty1sy2fs3jh0000gn/T/rw.hs:6:1: error:
    Could not load module ‘System.Random’
    It is a member of the hidden package ‘random-1.2.0’.
    You can run ‘:set -package random’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
6 | import System.Random {- random -}
  | ^^^^^^^^^^^^^^^^^^^^

/var/folders/xx/6v0ml_rn3_l0kty1sy2fs3jh0000gn/T/rw.hs:8:1: error:
    Could not load module ‘Sound.SC3’
    It is a member of the hidden package ‘hsc3-0.20’.
    You can run ‘:set -package hsc3’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘hsc3-0.19’.
    You can run ‘:set -package hsc3’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
8 | import Sound.SC3 {- hsc3 -}

Hello

Ech, that’s not good, I’m sorry…

I’ve made some changes to hsc3-graphs and stsc3 and hsc3.

I think the below will make it work, if you have any patience left!

  • git update all of the above (ie. hsc3, hsc3-graphs and stsc3)

  • in hsc3-graphs type cabal install to rebuild the hsc3-graphs binary (you may need to set cabals's overwrite-policy, it’s set to always in .cabal/config here, else I think it might not actually get installed)

  • run filein on stsc3/st/SC3-Haskell.st in your Smalltalk (that’s the only st file edited)

  • in hsc3 type cabal v1-install (note the v1- prefix, it’s important!)

After that I think the below should work (for wherever you have hsc3, there’s a new min argument…)

$ hsc3-graphs fragments hs min play ~/sw/hsc3/Help/Graph/jmcc-why-supercollider.hs

And if that works, then Smalltalk should work too.

I hope I haven’t left anything out!

Apologies again, teething… :frowning:

Best,
Rohan

Ps. Also none of the above will start scsynth! You’ll need to start it separately, from scide or the command line or however you normally start it. Also the above assumes that scsynth is listening at the default UDP port, which is 57110. Also it assumes that there is a group node 1, which sclang will make for you, but which you won’t get if you start scsynth on the command line.

Pps. Another quirk, the SC3Browser isn’t super portable. It works in Squeak, but in Pharo you can’t play graphs from the editor, there’s a right-click menu that only works in Squeak… This is a problem for files that have more than one graph in them, because these can’t be played from the top-level of the browser! I think there’re only a few files like that though. I don’t know what to do about the Squeak/Pharo situation.

Hi Rohan - no apologies necessary, it is you who is giving something for nothing not I! - glad to forge ahead if you are!

after git pull on all three repos, cabal install on hsc3-graphs gives me

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: hosc (user goal)
[__0] rejecting: hosc-0.20 (constraint from user target requires ==0.19)
[__0] rejecting: hosc-0.19.1, hosc-0.19, hosc-0.18.1, hosc-0.18, hosc-0.17,
hosc-0.16, hosc-0.15, hosc-0.14.1, hosc-0.14, hosc-0.13, hosc-0.12,
hosc-0.11.1, hosc-0.11, hosc-0.10.1, hosc-0.10, hosc-0.9, hosc-0.8, hosc-0.7,
hosc-0.6, hosc-0.5, hosc-0.4, hosc-0.3, hosc-0.2, hosc-0.1.1, hosc-0.1
(constraint from user target requires ==0.20)
[__0] fail (backjumping, conflict set: hosc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hosc

thx m

Hmmm. Sorry again!

That error looks like it’s not reading the cabal.project file, which tells it where to find hosc.

I just learned yesterday how to use CI at gitlab, so I added a build for this and it’s passed.

https://gitlab.com/rd--/hsc3-graphs/-/pipelines/323941215

I think that’s ghc-8.10.4.

I have ghc-8.8.4 here.

I’ll try and setup ghc-9.0.1 at gitlab and check that.

Is that what you’re on? Or maybe older? What cabal version? (Here it’s 3.0.0.0).

Feel free to reply to rd@slavepianos.org since this is rather too boring for the list!

Best,
Rohan

Hello,

Actually, gitlab makes binaries! There’s one at:

https://gitlab.com/rd--/hsc3-graphs/-/jobs/1361156794

It’s under Job artifacts on the right.

There’s a Download button.

It works here! Which is Debian 5.10.28-1 (2021-04-09) x86_64.

If you’re using something similar that may be an option?

Best,
Rohan

Are you a Kyma user as well? I am :wink:

I love Kyma, but alas I don’t have a system at the moment… SuperCollider is very lovely too, however!