Jupyter is an environment which allows to use a repl in a browser. This allows for rich text source code which can embedd videos, images, LaTeX code as well as audio. Jupyter is heavily used in Data Science and Machine Learning and is also known via the proprietary fork Google Colab.
I heard sagas that old SuperCollider versions supported rich text as source code - now it is back
I started coding this in 2020 and used it since to create some course materials for websites but decided to give this a proper release by anouncing it here. Have in mind that this is still a beta (currently @ v0.4.0
), any contributions are welcome.
Stepping into the Jupyter ecosystem allows to use e.g. Jupyter Book or use its real time collaboration features (see below).
Installation
Assuming you have python with pip installed as well as SuperCollider (of course) it is as easy as
pip3 install --upgrade sc_kernel
You may want to take a look at venv to keep your python environment clean.
Right now I am unsure if this will work under Windows - I don’t have a machine to test the delicate piping of the sclang process, any help via a PR is welcome here
I only tested this with macOS (intel) and Ubuntu 22.04
Quickstart
To start a Jupyter lab server simply call
jupyter lab
and create a new SuperCollider notebook.
If everything worked out one can execute sclang commands in the browser now.
As Jupyter is already cell oriented there is no need to create surrounding ( )
brackets anymore!
To execute a cell simply hit <shift> + <return>
.
Anything that is printed in sync by the command will be displayed below the cell, making it clear what each command returned.
So what is not printing printing in-sync? Tdef
, Routine
or s.boot
are running async - if these fails you are a bit out of luck currently in sc_kernel
as you won’t be seeing any error messages of them (I still don’t know how to handle async printing in a good way, any recommendations are welcome!)
Before we continue: The infamous <cmd> + .
command is not available here! To stop any sound simply enter a .
Features
I added some “magic functions” one is used to from the Python notebooks. These are simply functions which are prepended to each script cell call.
Check out the documentation for more extensive info about these features
Real time collaboration
Allows to share/sync/execute code over the network - each participant can join via a browser and can execute commands. The cursor of each participant is displayed as well.
This can allow for some cool shared live coding experiments!
Recording audio
Embedd a short snippet of your server audio directly into the notebook
Embedding plots
Autocomplete
Still WIP - completes class names (if they are longer than 3 chars) when hitting <tab>
asking the interpreter for matching classes.
I want to embedd method auto-completion here as well, probably for v0.5.0
.
Documentation
Display the raw schelp
file of a class by prepending a ?
to the class
Also works by hitting <shift> + <tab>
when the cursor is behind an existing class.
For v0.5.0
I maybe want to mimic displaying the help file via an inspector.