• Stars
    star
    203
  • Rank 192,890 (Top 4 %)
  • Language
    Scala
  • License
    GNU Affero Genera...
  • Created about 15 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Scala sound synthesis library based on SuperCollider. Mirror of https://codeberg.org/sciss/ScalaCollider

ScalaCollider

Gitter Build Status Maven Central Donate using Liberapay

statement

ScalaCollider is a SuperCollider client for the Scala programming language. It is (C)opyright 2008–2021 by Hanns Holger Rutz. All rights reserved. ScalaCollider is released under the GNU Affero General Public License v3+ and comes with absolutely no warranties. To contact the author, send an e-mail to contact at sciss.de.

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's function is more reduced than 'SCLang', 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 (Pdef, Routine, etc.) must be added through dedicated libraries (see section 'packages' below).

While ScalaCollider itself is in the form of a library, you can use it inside a plain REPL, or via the ScalaCollider-Swing project that adds an easy-to-use standalone application or mini-IDE. On the ScalaCollider-Swing page, you'll find a link to download a readily compiled binary for this standalone version.

Note: An even more elaborate way to use ScalaCollider, is through SoundProcesses and its graphical front-end Mellite.

download and resources

The current version of ScalaCollider (the library) can be downloaded from github.com/Sciss/ScalaCollider.

More information is available from the wiki at github.com/Sciss/ScalaCollider/wiki. The API documentation is available at sciss.de/scalaCollider/latest/api.

The best way to ask questions, no matter if newbie or expert, is to use the Gitter channel (see badge above) or the mailing list at groups.google.com/group/scalacollider. To subscribe, simply send a mail to [email protected] (you will receive a mail asking for confirmation).

The early architectural design of ScalaCollider is documented in the SuperCollider 2010 symposium proceedings: H.H.Rutz, Rethinking the SuperCollider Client.... However, many design decisions have been revised or refined in the meantime.

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 application's interpreter window.

See the section 'starting a SuperCollider server' below, for another simple example of running a server (possibly from your own application code).

building

ScalaCollider builds with sbt against Scala 2.13, 2.12, Dotty (JVM) and Scala 2.13 (JS). The last version to support Scala 2.11 was 1.28.4. Note that because of an incompatibility between ScalaOSC and Scala.js, support for Scala.js is currently incomplete, and consequently some OSC related tests are not run under Scala.js.

ScalaCollider requires SuperCollider server to be installed and/or running. The recommended version as of this writing is 3.10. Note that the UGens are provided by the separate ScalaColliderUGens project. A simple Swing front end is provided by the ScalaColliderSwing project.

Targets for sbt:

  • clean – removes previous build artefacts
  • compile – compiles classes into target/scala-version/classes
  • doc – generates api in target/scala-version/api/index.html
  • package – packages jar in target/scala-version
  • rootJVM/console – opens a Scala REPL with ScalaCollider on the classpath

linking

To use this project as a library, use the following artifact:

libraryDependencies += "de.sciss" %% "scalacollider" % v

The current version v is "2.7.3"

contributing

Please see the file CONTRIBUTING.md

REPL test

Here is how a quick REPL check looks. sbt rootJVM/console will start with default Scala (2.13), while sbt ++3.0.0 rootJVM/console allows you to use the new Scala 3.

$ sbt rootJVM/console
[info] welcome to sbt 1.5.2 (Debian Java 11.0.11)
...
[info] loading settings for project scalacollider-build from plugins.sbt ...
[info] loading project definition from ~/Documents/devel/ScalaCollider/project
[info] loading settings for project scalacollider from build.sbt ...
[info] set current project to scalacollider (in build file:~/Documents/devel/ScalaCollider/)
[info] Starting scala interpreter...
Welcome to Scala 2.13.5 (OpenJDK 64-Bit Server VM, Java 11.0.11).
Type in expressions for evaluation. Or try :help.
import de.sciss.osc
import de.sciss.synth._
import de.sciss.synth.ugen._
import Predef.{any2stringadd=>_, _}
import Import._
import Ops._
def s: de.sciss.synth.Server
def boot(): Unit

scala> boot()

scala> Found 109 LADSPA plugins
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 1024
SuperCollider 3 server ready.
JackDriver: max output latency 42.7 ms

scala> play {
| val f = LFSaw.ar(20).linExp(-1, 1, 300, 600)
| val s = SinOsc.ar(Seq(f, f * 1.01))
| s * 0.3
| }
val res1: de.sciss.synth.Synth = Synth(<localhost>,1000) : <temp_1>

scala> s.freeAll()

An alternative terminal REPL is Ammonite. If you have it installed, you can launch it with amm and "import" ScalaCollider:

$ amm
Loading...
Welcome to the Ammonite Repl 2.4.0 (Scala 2.13.6 Java 11.0.11)
@ import $ivy.`de.sciss::scalacollider:2.6.4`, de.sciss.synth._, Import._, Ops._, ugen._ 
import $ivy.$                              , de.sciss.synth._, Import._, Ops._, ugen._

@ Server.run(_ => ()) 

@ Found 109 LADSPA plugins
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 1024
SuperCollider 3 server ready.
JackDriver: max output latency 42.7 ms
@ play { WhiteNoise.ar(Seq.fill(2)(0.3)) } 
res2: Synth = Synth(server = <localhost>, id = 1000)

@ Server.default.freeAll()
  
@ exit 
Bye!

starting a SuperCollider server

Inside a regular Scala source code file, the following short example illustrates how a server can be launched, and a synth played:

import de.sciss.synth._
import ugen._
import Import._
import Ops._

val cfg = Server.Config()
cfg.program = "/path/to/scsynth"
// runs a server and executes the function
// when the server is booted, with the
// server as its argument 
Server.run(cfg) { s =>
  s.dumpOSC()
  // `play` is imported from object `Ops`.
  // It provides a convenience method for wrapping
  // a synth graph function in an `Out` element
  // and playing it back.
  play {
    val f = LFSaw.kr(0.4).mulAdd(24, LFSaw.kr(Seq(8, 7.23)).mulAdd(3, 80)).midiCps
    CombN.ar(SinOsc.ar(f) * 0.04, 0.2, 0.2, 4)
  }
}    

For more sound examples, see ExampleCmd.sc. There is also an introductory video for the Swing frontend at www.screencast.com/t/YjUwNDZjMT, and some of the Mellite tutorials also introduce ScalaCollider concepts.

Troubleshooting: If the above boots the server, but on Linux you do not hear any sound, probably the Jack audio server does not establish connections between SuperCollider and your sound card. The easiest is to use a program such as QJackCtl to automatically wire them up. Alternatively, you can set environment variables SC_JACK_DEFAULT_INPUTS and SC_JACK_DEFAULT_OUTPUTS before starting Scala, e.g.

export SC_JACK_DEFAULT_INPUTS="system:capture_1,system:capture_2"
export SC_JACK_DEFAULT_OUTPUTS="system:playback_1,system:playback_2"

Specifying SC_HOME

Note: This section is mostly irrelevant on Linux, where scsynth is normally found on $PATH, and thus no further customisation is needed.

You might omit to set the program of the server's configuration, as ScalaCollider will by default read the system property SC_HOME, and if that is not set, the environment variable SC_HOME. Environment variables are stored depending on your operating system. For example, if you run ScalaCollider from a Bash terminal, you edit ~/.bash_profile. The entry is something like:

export SC_HOME=/path/to/folder-of-scsynth

On linux, the environment variables probably go in ~/.profile or ~/.bashrc.

packages

ScalaCollider's core functionality may be extended by other libraries I or other people wrote. The following three libraries are dependencies and therefore always available in ScalaCollider:

  • UGens are defined by the ScalaCollider-UGens library.
  • Audio file functionality is provided by the AudioFile library.
  • Open Sound Control functionality is provided by the ScalaOSC library.

Here are some examples for libraries not included:

  • Patterns functionality is available through the Patterns library, which is supported through SoundProcesses rather than vanilla ScalaCollider. SoundProcesses also takes the role of more high-level abstractions similar to NodeProxy, for example.
  • MIDI functionality can be added with the ScalaMIDI library.
  • Plotting is most easily achieved through Scala-Chart, which is conveniently included in ScalaCollider-Swing.

More Repositories

1

Mellite

An environment for creating experimental computer-based music and sound art. Mirror of https://codeberg.org/sciss/Mellite
Scala
99
star
2

FScape

A standalone audio rendering software for time domain and spectral signal processing. Mirror of https://codeberg.org/sciss/FScape
Java
68
star
3

FingerTree

A Scala implementation of the versatile purely functional data structure of the same name.
Scala
61
star
4

Eisenkraut

A multi-channel and hi-res capable audio file editor. Mirror of https://codeberg.org/sciss/Eisenkraut
Java
53
star
5

ws4j

WordNet Similarity for Java provides an API for several Semantic Relatedness/Similarity algorithms. Mirror of https://codeberg.org/sciss/ws4j
Java
43
star
6

Strugatzki

Algorithms for matching audio file similarities. Mirror of https://codeberg.org/sciss/Strugatzki
Scala
40
star
7

SyntaxPane

A simple to use Swing JEditorKit component supporting syntax highlighting for various languages. Mirror of https://codeberg.org/sciss/SyntaxPane
Java
33
star
8

SoundProcesses

A computer music framework to describe, create and manage sound processes in the Scala programming language. Mirror of https://codeberg.org/sciss/SoundProcesses
Scala
31
star
9

ScalaOSC

OpenSoundControl (OSC) library for the Scala programming language. Mirror of https://codeberg.org/sciss/ScalaOSC
Scala
25
star
10

ScalaInterpreterPane

A simple Swing wrapper using JSyntaxPane to drive the Scala Language Interpreter. Mirror of https://codeberg.org/sciss/ScalaInterpreterPane
Scala
23
star
11

SwingOSC

An OpenSoundControl (OSC) server to dynamically instantiate and control Java objects. Its main application is a GUI library for SuperCollider.
HTML
22
star
12

AudioFile

Audiofile library for Scala. Mirror of https://codeberg.org/sciss/AudioFile
Scala
22
star
13

ScalaColliderSwing

A Swing based front end or "mini-IDE" for ScalaCollider. Mirror of https://codeberg.org/sciss/ScalaColliderSwing
Scala
16
star
14

ScalaMIDI

A library for accessing MIDI controllers and standard MIDI files. Mirror of https://codeberg.org/sciss/ScalaMIDI
Scala
15
star
15

TreeTable

Swing components, accessories, utilities, etc for use in a GUI. Mirror of https://codeberg.org/sciss/TreeTable
Java
15
star
16

FileUtil

Simple Scala enrichments for java.io.File.
Scala
14
star
17

ScalaColliderJSTest

Testing ScalaCollider compiled to JavaScript in the browser along with SuperCollider server (scsynth) compiled to WebAssembly.
JavaScript
13
star
18

NetUtil

NetUtil is a Java library for sending and receiving messages using the OpenSoundControl (OSC) protocol. Mirror of https://codeberg.org/sciss/NetUtil
Java
13
star
19

FScape-next

Audio rendering software, based on UGen graphs. Issue tracker: https://codeberg.org/sciss/FScape-next/issues
Scala
13
star
20

SpeechRecognitionHMM

Exported from http://code.google.com/p/speech-recognition-java-hidden-markov-model-vq-mfcc . Current repo now here: https://github.com/gtiwari333/speech-recognition-java-hidden-markov-model-vq-mfcc
Java
12
star
21

KollFlitz

Useful methods for Scala collections.
Scala
12
star
22

Prefuse

A toolkit for building interactive information visualization applications. Mirror of https://codeberg.org/sciss/Prefuse
Java
11
star
23

abc4j

abc4j music notation library, a fork from https://code.google.com/p/abc4j/
Java
11
star
24

Wolkenpumpe

A GUI extension to SoundProcesses, creating a live improvisation instrument. Mirror of https://codeberg.org/sciss/Wolkenpumpe
Scala
9
star
25

Impulse

A simple tool to record sound impulse responses. Mirror of https://codeberg.org/sciss/Impulse
Scala
8
star
26

Topology

A dynamic directed acyclic graph library. Mirror of https://codeberg.org/sciss/Topology
Scala
8
star
27

ScissDSP

Collection of DSP algorithms and components for Scala. Mirror of https://codeberg.org/sciss/ScissDSP
Scala
7
star
28

Processor

A simple mechanism for running asychronous processes in Scala. Mirror of https://codeberg.org/sciss/Processor
Scala
7
star
29

ComposersDesktopProject

A suite of offline processes for transforming audio files
C
6
star
30

Kontur

A multitrack sound editor, based on ScalaCollider, and with the ability to algorithmically manipulate the timeline regions.
Scala
6
star
31

ScalaAndroidCollider

Proof of concept: ScalaCollider runs on Android - NOTE: very old and abandoned
Scala
6
star
32

NeovimSwing

Embedding Neovim in a Swing/Java2D UI written in Scala. Mirror of https://codeberg.org/sciss/NeovimSwing
Scala
6
star
33

Desktop

Application framework for Scala on the desktop. Mirror of https://codeberg.org/sciss/Desktop
Scala
5
star
34

ScalaWordNet

Scala bindings around WordNet and WS4j. Mirror of https://codeberg.org/sciss/ScalaWordNet
Scala
5
star
35

Numbers

A collection of numeric functions and type enrichments.
Scala
5
star
36

Submin

A Swing look-and-feel based on WebLaF with dark and light skin. Mirror of https://codeberg.org/sciss/Submin
Java
4
star
37

ScalaFreesound

Freesound database queries and downloads for Scala.
Scala
4
star
38

RaphaelIcons

Icon set for Java2D/Scala, designed by Dmitry Baranovskiy.
Scala
4
star
39

ScalaColliderUGens

UGen database and code synthesizer to generate class files for ScalaCollider. Mirror of https://codeberg.org/sciss/ScalaColliderUGens
Scala
4
star
40

jawjaw

Automatically exported from code.google.com/p/jawjaw
Java
3
star
41

Patterns

A pattern library for Scala and SoundProcesses, inspired by SuperCollider's.
Scala
3
star
42

Poirot

A Scala front-end for the JaCoP constraints solver library.
Scala
3
star
43

Lucre

Lucre (STM|Event|Data|Confluent) - a transactional, persistent, reactive object model. Mirror of https://codeberg.org/sciss/Lucre
Scala
3
star
44

Mellite-piksel21

Materials for the Mellite workshop at Piksel festival 2021
Processing
3
star
45

Mellite-website

Website of https://sciss.de/mellite
Scala
3
star
46

GUIFlitz

Automatic GUI from case classes for rapid prototyping. Mirror of https://codeberg.org/sciss/GUIFlitz
Scala
3
star
47

SoundProcessesJSTest

Sandbox project to find out if we can run SoundProcesses workspaces in the browser.
Scala
3
star
48

SwingPlus

The missing bits for Scala-Swing (additional components and methods). Mirror of https://codeberg.org/sciss/SwingPlus
Scala
3
star
49

JCollider

Java client for SuperCollider (archived project)
Java
3
star
50

Equal

Simple macro-based type safe equals operator ===.
Scala
2
star
51

Cord

Patcher system for the Web (experimental). Mirror of https://codeberg.org/sciss/Cord
Scala
2
star
52

ProcessConsoleWatch

Utility that detects patterns in console text and reacts
Scala
2
star
53

EmbindTest

Step by step getting to setting up a web audio script processor node whose audio processing function is a function of a C++ class.
C++
2
star
54

PDOSCClient

A bi-directional OSC object for PureData to be used with the pdj plugin, or Max with the mxj plugin.
Java
2
star
55

Infibrillae

An audiovisual poem for a screen based installation or the web browser. Mirror of https://codeberg.org/sciss/Infibrillae
Scala
2
star
56

ScreenStitch

Quickly hacked tool to arrange various screenshots (typically from maps) and glue the parts together. Mirror of https://codeberg.org/sciss/ScreenStitch
Scala
2
star
57

ScissLib

Java library for desktop application development. Mirror of https://codeberg.org/sciss/ScissLib
Java
1
star
58

ImperfectReconstruction

An algorithmic art project
Scala
1
star
59

Wr_t_ng-M_ch_n_

A sound installation.
Scala
1
star
60

PraiseOfEquiforms

Some algorithmic treatment of a text
Scala
1
star
61

Stadtpark

Algorithms for a sound piece
Scala
1
star
62

Mellite-tutorials

Tutorial code for the Mellite website.
Scala
1
star
63

bdb-je

Berkeley DB Java Edition - key value store (mirror)
Java
1
star
64

SubtitleTools

Some tools to manipulate srt (SubRip) files
Scala
1
star
65

Muta

Building blocks for Desktop based Genetic Algorithms
Scala
1
star
66

Mellite-launcher

Application launcher and updater for Mellite.
Scala
1
star
67

AudioWidgets

Specialized Swing widgets for audio applications in Scala. Mirror of https://codeberg.org/sciss/AudioWidgets
Scala
1
star
68

LinuxConfig

My personal configuration files. Mirror of https://codeberg.org/sciss/LinuxConfig
Shell
1
star
69

GitSync

Scan directory for git repositories and report if they diverge from origin
Scala
1
star
70

Schwaermen

An art project.
Scala
1
star
71

sciss.github.io

GitHub user page
CSS
1
star
72

FolderToHTML

Simple tool to create an HTML index file from a folder.
Scala
1
star
73

Infiltration

Materials, such as sketches, code, or Mellite workspaces, relating to the sound installation piece "in|filtration" and its research process.
Scala
1
star
74

Cracks

An algorithmic art project
Scala
1
star
75

GitVis

Visualizing some git histories.
Scala
1
star
76

SonogramOverview

Sonogram view component for Scala/Swing, calculating offline from audio files. Mirror of https://codeberg.org/sciss/SonogramOverview
Scala
1
star
77

AdwaitaGtk2Dark

Patch for Adwaita Gnome 3.14 theme to have dark windows for Gtk-2 applications
1
star