
ChucK: Strongly-timed, Concurrent, and On-the-fly Music Programming Language - mindcrime
http://chuck.cs.princeton.edu/
======
thealphanerd
This language was written by a professor of mine Ge Wang, also the founder of
Smule.

He likes to refer to it as "strongly timed", and I think it is a really
accurate description. While the language does have limitations, it can also be
beautifully expressive for certain things.

If anyone has any question for the author please let me know and I'll either
get him to come in here or be a surrogate and answer directly

~~~
p4bl0
I don't have the time to investigate the language, but I wonder if its
semantics borrows from synchronous programming languages such as Lustre [1],
Esterel [2], or Signal [3]? Those languages were designed to program discrete
controllers and embedded real time systems, and they have a very strong notion
of timing and scheduling (via typing) in their semantics which allows to prove
functional properties such as accessibility of states, liveness, time and
memory bounds, etc. using formal methods such as model checking.

When I was doing my master thesis on this domain, another student in the lab
(who was from an IRCAM [4] master degree) worked on the use of synchronous
languages to follow a musician who plays at arbitrary speed a given music
score (or something along those lines). It was quite fun!

[1]
[https://en.wikipedia.org/wiki/Lustre_%28programming_language...](https://en.wikipedia.org/wiki/Lustre_%28programming_language%29)

[2]
[https://en.wikipedia.org/wiki/Esterel](https://en.wikipedia.org/wiki/Esterel)

[3]
[https://en.wikipedia.org/wiki/SIGNAL_%28programming_language...](https://en.wikipedia.org/wiki/SIGNAL_%28programming_language%29)

[4] [http://www.ircam.fr/?&L=1](http://www.ircam.fr/?&L=1)

~~~
diminish
I've completed the ChucK course on Coursera. As far as I can say, it doesn't
borrow semantics directly from synchronous programming languages though it may
parallel them. Syntactically it's similar too Java/C++.

Time/Duration are data types, and you must advance "now" to generate samples
and events.

------
curtisullerich
Another system for live interaction with music is Extempore [0], for which you
can code in either Scheme or xt-lang. There are some very impressive videos of
it in action [1]. Extempore is a re-designed version of Impromptu [2] which
was somewhat more restrictive in terms of platforms and editor integration.

I don't understand ChucK or Extempore well enough at a lower level (yet) to
provide a good comparison, but I'm just happy to see people introduced to any
music hacking tools. :)

[0] [http://extempore.moso.com.au/](http://extempore.moso.com.au/) [1]
[http://vimeo.com/groups/82430/sort:plays/format:thumbnail](http://vimeo.com/groups/82430/sort:plays/format:thumbnail)
[2] [http://impromptu.moso.com.au/](http://impromptu.moso.com.au/)

------
maxehmookau
ChucK is old news in electronic music circles. SuperCollider
([http://supercollider.sourceforge.net/](http://supercollider.sourceforge.net/))
is (I believe) the most popular and well-maintained of these languages.
Overtone is just a clojure wrapper around the SuperCollider application. (It's
pretty neat too!)

~~~
nutate
define old news? It's technically newer than SuperCollider by quite a bit.
ChucK has a lot of users in the laptop orchestra world.

Even CSound has had resurgence with iOS apps. Likewise with Pd. I'm really
liking the haskell based sample player Tidal, that's a lot of fun.

------
acjohnson55
I very briefly worked on ChucK while at Princeton years ago, although I never
finished my contribution to be an official committer. Having spent a decent
amount of time with it, I think the biggest problem with ChucK is lack of
flexibility within the strongly-timed model. The ChucK operator, `=>` is used
to connect together unit generators, but as I recall, you can't use it to
connect arbitrary ports of those unit generators together. Each has only one
designated ChucK input and/or output. This makes it difficult to truly
experiment with modulation. You pretty quickly reach a point where you end up
writing the same old procedural code you'd write in C or Java, explicitly
manipulating samples instead of streams.

There are many other systems that are similar, including SuperCollider,
Max/MSP, PureData, CSound and JSyn/JMSL.

I think the intuition behind ChucK is similar to the functional reactive
programming of Elm [1]. But it's doesn't seem as though it's thought
completely through. It would be cool to see a true FRP implementation for
sound.

~~~
droithomme
> you can't use it to connect arbitrary ports of those unit generators
> together. Each has only one designated ChucK input and/or output. This makes
> it difficult to truly experiment with modulation

You can route things to multiple destinations with multiple ChucK operators.

You can also route to specific inputs by naming them.

Arbitrary routings are neither impossible nor a problem.

SinOsc A => dac.left; // Here, A's main output connects to a specific input of
object dac.

SinOsc B => dac;

A => B.freq; // Here we see the same A having another output connection, and
connecting to a specific input of another object to create FM modulation.

~~~
droithomme
NOTE: please ignore above post. I shouldn't post before coffee, or without
checking code. Routing A's audio output to B's frequency control output does
require doing it in a loop since A's output is not compatible with freq's
input. Have to do: A.last() => B.freq, and last() is the current sample, so
needs to be called in a loop to work, which is what AC was saying - parameter
modulation ends up being fiddling with individual samples.

------
jonnybgood
For those unfamiliar with Algoraves and live coding:
[http://motherboard.vice.com/nl/read/algorave-coden-in-de-
clu...](http://motherboard.vice.com/nl/read/algorave-coden-in-de-club)

~~~
wavesounds
I like the set in this article: [http://www.vice.com/en_uk/read/algorave-is-
the-future-of-dan...](http://www.vice.com/en_uk/read/algorave-is-the-future-
of-dance-music-if-youre-an-html-coder)

------
lalos
See ChucK in action ->
[https://www.youtube.com/watch?v=IkbjktiF52k](https://www.youtube.com/watch?v=IkbjktiF52k)

------
peapicker
ChucK's pretty fun, I've played around with it a little to write a couple of
electronic demos... I like the fact that i can do full-on generative synthesis
with it - samples can be used, but it is more fun for me to craft sounds
algorithmically.

This one's a laid-back idea for a 'chillout' song I haven't finished:

[https://soundcloud.com/sigint-trax/national-degeneration-
uni...](https://soundcloud.com/sigint-trax/national-degeneration-unit)

This one is an experiment that involved the main melody being manipulated
randomly by a mutation algorithm I wrote:

[https://soundcloud.com/sigint-
trax/mutation-0x1337](https://soundcloud.com/sigint-trax/mutation-0x1337)

------
catshirt
i'm not really sure ChucK gets a lot of real use. it seems libraries like
overtone have surpassed it in popularity, i assume because of the language
accessibility.

it has some really interesting concepts built into the language, like time.
but in my experience this doesn't provide huge value for the purpose of
composition, especially since when you are writing code livecoding is
typically loop based.

i'd love a ChucK VM for the web audio API. on the back burner; things i should
do but won't.

~~~
lewisgodowski
The Smule music apps (Ocarina, Leaf Trombone, etc.) are all written using
ChucK, IIRC.

Outside of that, you're right -- it's not widely used -- although, at CalArts
(where I currently go to college,
[http://www.calarts.edu](http://www.calarts.edu)), it's extremely popular in
the Music Technology department. We use it mainly for handling MIDI->OSC
translation to control robotic instruments
([http://www.karmetik.com/media](http://www.karmetik.com/media)) and
interfacing other electronics, like custom built musical interfaces and
controllers, with music software.

~~~
ics
Also worth noting that they offered a ChucK course on Coursera:
[https://www.coursera.org/course/chuck101](https://www.coursera.org/course/chuck101)

~~~
clay_to_n
This was good! Starts out with very basic programming stuff, but overall gives
you a nice introduction to what ChucK can do.

------
notthetup
There is also overtone which is a framework for doing something similar.
Written in clojure.

[http://overtone.github.io/](http://overtone.github.io/)

~~~
JonnieCache
Thanks for this. I could never get into supercollider and my own custom MIDI-
outputting code never managed to keep time properly.

Now I can write my automatic-jazz-improvisation sequencer!

EDIT: good to see it still has BBCut built into it, for LISPy amen choppage
fun.

Now my brain is melting at the thought of recursively defined, lazily-
evaluated breakcore. I think I need a lie down.

------
pervycreeper
Many that I've talked to in the electronic music community seem to prefer
supercollider currently for actual use.

------
pramalin
I have toyed a bit with CSound
[http://www.csounds.com/toots/index.html](http://www.csounds.com/toots/index.html)
to synthesize Indian classical music.

How does ChucK compares to CSound?

~~~
acjohnson55
It's tough to make a direct comparison. They're very different systems. Here
are a couple thoughts:

\- From what I recall, ChucK doesn't really have any equivalent to CSound's
score -- you just procedurally schedule changes. If you've every seen JSyn
[1], I think ChucK is roughly equivalent to it, but with the language adapted
to be more music centric than Java. JMSL [2] is roughly a Java equivalent to
CSound's score file, and I don't know of anything in ChucK that fills that
role.

\- CSound is not really built for modularity or flexible routing between
components. ChucK is better in that regard.

\- CSound also has the benefit of a couple decades worth of usage and all
sorts of interesting corners to its ecosystem.

I'm sorry if this isn't a very coherent comparison. I haven't used CSound in a
few years, and ChucK in even longer. If you're doing classical music, I
imagine you'll value CSound's scoring capabilities over ChucK's synthesis
flexibility.

[1] [http://www.softsynth.com/jsyn/](http://www.softsynth.com/jsyn/)

[2] [http://www.algomusic.com/jmsl/](http://www.algomusic.com/jmsl/)

------
wavesounds
Someone with a bar in SF/Oakland start booking live coding please.

------
rainmaking
I'm more of a SuperCollider guy but Chuck is good enough for a major SC
contributor to implement a Chuck operator for his lib.

------
mtodd
Tangentially related is the Yale Haskell Group's (well, mostly Paul Hudak's)
project Euterpia:
[http://haskell.cs.yale.edu/euterpea/](http://haskell.cs.yale.edu/euterpea/)

------
gariany
ChunK: seems so old-fashion comparing to algorave.com guys
[https://www.youtube.com/watch?v=fZppekP_XAg](https://www.youtube.com/watch?v=fZppekP_XAg)

------
geoffroy
Thanks ! I didn't know there was a new version. The lack of stereo UGens
brought me to Super Collider since then but I like the Chuck coding style.
Cheers

------
plicense
Am I the only one to read it as "Chuck the Strongly-timed, Concurrent, and On-
the-fly Music Programming Language" ?

