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.

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)).madd(3, 80)
  val f = LFSaw.kr(0.4).madd(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:

If you want to build from the source code, go to github.com/Sciss/ScalaCollider.

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

  • Java (Java 8 is recommended, Java 9 might cause problems)
  • SuperCollider (version 3.9.1 is recommended, but 3.6.x and up should work, too)

resources

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

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.

The source code for this page can be found here.