Commission Music

Commission Music
Bespoke Noise!!

Saturday, 25 September 2010

Hanns Holger Rutz: ScalaCollider

Live blogging the sc symposium

What's the difference between high level and low-level

Why should computer music have a specialised languages?

In 2002, JMC rejected the GPL languages that he considered, because they didn't have the features he needed. But OCaml, Dylan, GOO and Ruby seemed good candidates, which are OOP + FP. They have dynamic typing.

There are a lot of languages that talk to Sc Server now. He has a table of several languages and the libraries which extend them to supercollider.

Are they dynamically types or static? Object oriented? Functional? Do the extension libraries handle UGen graphs? Musical Scheduling? Do they have an interactive mode? (All do but Java and Processing.) A domain-specific gui?

And now a slide of UGen graphs in a bunch of other languages. ScalaCollider is virtually identical to SuperCollider

What's the Scala Language? Invented in 2003 by a Swiss Scientist, Martin Odersky at EPFL. Has a diverse community of users. It's a pragmatic language Scala = Scalable language. It draws from Haskell and OCaml, but has java-like syntax. Runs on top of JVM (or .Net). Thus it is interoperable with java and is cross-platform. IS both OOP and FP.

Type at the prompt, "scala" and it opens an interpreter window.

def isPrime(n: Int) = (2 until n) forall (n % _ != 0)
isPrime: (n: Int)Boolean

If you type "isPrime(3.4)" you get a type error.

def test(n: Float) = isPrime(n)

Also causes a type error

There are also lazy types. Has different names for stuff than sc, but many of the same concepts.

Scala does not easily allow you to add methods to existing classes. You use a wrapper class. You need to do explicitly class conversions. However, there is a way to tell the interpreter that there's a method to do class conversions.

You want to pick a language that will still have a user base in 10 years. Ho o predict that? fun tricks with statistics. Scala is less popular than fortran or forth. It's very well designed, though. You can also poll communities in what they think about the language. Users find it expressive, good at concurrency, people like using it, good for distributed computing, reusable code, etc. Downsides is that there's not a lot of stuff written in it. .

The Swing thing just opens a development environment, which doesn't have a way to save documents. Really not yet ready for prime time.

Side effect-free ugens are removed automatically from SynthGraphs

ScalaDoc creates javadoc-like files describing APIs.

Now there's some code with a lot of arrows.

The class Object has 278 methods, not even counting quarks. Subclasses get overwhelmed. Scala's base object java.lang.Object has only 9 methods.

Scala has multiple inheritance.

(Ok, this talk is all about technical details. The gurus are starting to make decisions about SC4, which will probably include SuperNova server and might switch to Scala Collider and this talk is important for that. However, ScalaCollider is not yet fixed and may or may not be the future of SC, so it's not at all clear that it's worthwhile for average users to start learning this, unless, of course, you want to give feedback on the lang, which would make you a very useful part of the SC community. So if you want to help shape the future of SC, go for it. Otherwise, wait and see.)

Latency may be an issue, plus there's not realtime guarantees. In practice, this ok. The server handles a lot of timing issues. The JIT might also cause latency. You might want to pre-load all the classes.

In conclusion, this might be the future. Sclang is kind of fragmented, because classes can't be made on the fly, some stuff is written in C, etc. In Scala, everything is written in Scala, no primitives, but still fast

No comments: