ScalaCollider

ScalaCollider is a real-time sound synthesis and signal processing system, based on SuperCollider and the Scala programming language. It can be used as a library in a Scala application, but there is also a small stand-alone prototyping environment called ScalaCollider-Swing. See Mellite for a more comprehensive IDE.

ScalaCollider-Swing Screenshot

SuperCollider is one of the most elaborate open source sound synthesis frameworks. It comes with its own language, sclang, that controls the sound synthesis processes on a server, scsynth. ScalaCollider is an alternative to sclang, giving you the (perhaps) familiar Scala language to express these sound synthesis processes, and letting you hook up any other Scala, Java or JVM-based libraries.

ScalaCollider
play {
  val o = LFSaw.kr(Seq(8, 7.23)).mulAdd(3, 80)
  val f = LFSaw.kr(0.4).mulAdd(24, o)
  val s = SinOsc.ar(f.midiCps) * 0.04
  CombN.ar(s, 0.2, 0.2, 4)
}
sclang
play {
  var o = LFSaw.kr([8, 7.23], 0, 3, 80);
  var f = LFSaw.kr(0.4, 0, 24, o);
  var s = SinOsc.ar(f.midicps) * 0.04;
  CombN.ar(s, 0.2, 0.2, 4)
}

ScalaCollider’s function is more reduced than sclang’s, focusing on UGen graphs and server-side resources such as buses and buffers. Other functionality is part of the standard Scala library, e.g. collections and GUI. Other functionality, such as plotting, MIDI, client-side sequencing (Pdefs, Routines, etc.) must be added through dedicated libraries. The documentation on this site assumes some familiarity with SuperCollider, and will do its best to help users coming from SuperCollider to understand the basic concepts of Scala and ScalaCollider.

download

To start hacking straight away, download the latest version of ScalaCollider-Swing. A version is also maintained on archive.org.

Note: Unfortunately, I don’t always manage to upload the latest binaries, so you may find that the newest version is available for building from source code: codeberg.org/ScalaCollider and codeberg.org/ScalaColliderSwing.

In order to run ScalaCollider, you also need to have installed on your computer:

  • Java (Java 11 or 8 recommended, Java 9 might cause problems)
  • SuperCollider (version 3.10.x is recommended, but 3.8.x and up should work, too)

resources

The best way to ask questions, no matter if newbie or expert, is to use the following channel:

The file ExampleCmd.sc is a good starting point for understanding how UGen graphs are written in ScalaCollider. You can directly copy and paste these examples into the ScalaCollider-Swing prototyping environment. If you start it for the first time, you may have to adjust the location of the scsynth or scsynth.exe program in the preferences. Press the boot button to fire up the SuperCollider server. Then, select an example and press Shift+Return to execute. Hover over a UGen name (e.g. Mix or SinOsc) and press Ctrl+D to open its help file.

For reference, consult the API documentation.