Haunted House

Origo is a funnyface (0,0)

Return of the ChucK!

Posted by Gasten on July 22, 2007

(Despite this post’s name, it will not – I repeat; will not – contain any Chuck Norris jokes. Stop looking!)

Ok, so after reading this post about some vim tricks, I – for some reason that I can’t remember – thought about the audio/live coding-language that I were playing with maybe a year ago. That language were – of course ChucK. It’s a blunt little live coding environment with some nifty features – or as the website say: “ChucK is a Strongly-timed, Concurrent, and On-the-fly
Audio Programming Language.”

One thing that bugged the hell out of me when I tested it last time, was that the system was extremely clumsy when I wanted to spork a new shred, or replace an old shred(meaning: adding a new track, or updating the audio in a existing track). I used Gedit, so I had to code everything there, save, go to a terminal and type a command every time I wanted to hear what I were doing – that’s actually pretty tideous when you are just experimenting with different oscillator/filter-settings. Since I putted ChucK on the shelf I’ve been toying with the text-editor vim, so when I read that you could execute commands inside vim I though I should give it another go.

So, well. I hacked together a couple of lines for my .vimrc to alias some of the most frequently used chuck-commands:

command Cadd ! chuck + %
command -nargs=1 Cdel ! chuck -
command -nargs=1 Crep ! chuck = %
command Cstat ! chuck --status
command Ckill ! chuck --kill

(It would be great if someone who are more skilled with vim could provide a way to make Cdel and Crep take another optional filename as argument instead of always using the current file (which would be used if no argument were provided))

Yeah, I’ve mostly been kicking around with that. found this highlighting-file for vim today (also, I modified it to highlight the new way of writing UGens). That’s all good.

So, is ChucK any good? Well, last time I used it I lost interest pretty fast and started looking at SuperCollider. ChucK and Supercollider are pretty different, even if their goal is mostly the same. At the first glance, Supercollider is much easier to make some sound in. Just

{ SinOsc(440, 0, 0.2) }.play;

if I remember correctly. The same thing in ChucK:

SinOsc s => dac;
440 => s.freq;
0.2 => s.gain;
while(true) {
    2::second => now;

Sure, it takes a little more code. On the other hand, when you get a bit further and want to change a variable over time, chuck is lot easier since everything is already there (just add “550 => s.freq;” before the “}”). In SC you need to build Patterns and Schedules and stuff (never really figured it out). Also, In ChucK you don’t need any JITlib to have live coding and on-the-fly programming. Shreds built in.

True, everything wasn’t just great this time either. Something I got fond of when I used SuperCollider was the ability to use any oscillator as a control-value spitter. like this:

SinOsc.ar(SinOsc.kr(0.5, 0, 200, 400), 0, 0.2)}.play;

This does not work as simple in ChucK, something that is very regretful. The same patch in ChucK (took me more than half a dozen tries to make it….):

SinOsc s => Gain g => dac;
SinOsc lfo => blackhole;
1.0 => lfo.freq;
300 => lfo.gain;
0.2 => g.gain;
// control-value to something bigger to let it have a glitchier effect!
while(10::ms => now) {
    lfo.last() + 900.0 => s.freq; //rubbie!

That’s actually pretty nasty. Well, off am I to see if I can do some other cool patches!


ps. Do anyone know how I can preserve my indents without doing hard space-symbols (“and-nbsp-semicolon”) inside code-tags? I also have a problem with code-tags getting formatted to the default text after a blank line.

pps. If someone disagree, please leave a comment!


2 Responses to “Return of the ChucK!”

  1. Chris said


    Chuck now wants –kill and –status as flags, so I modified my vimrc to match, and now when I try to execute, I get [chuck]: invalid flag ‘-�X�status’ – vim is doing something odd to the –…

    I’ve tried various quoting methods and looked at the docs but I haven’t come across a solution yet. Any ideas?

    Thanks, and I appreciate you posting your information on this, it was just what I was looking for since my compile of miniAudicle chews my CPU for some reason…


  2. Gasten said

    Took me a couple of minutes, but now I think I see what is wrong! WordPress, without my knowledge, substituted my double-dash with one long dash (as some office-grade word processors do). So, the correct syntax is with a double-dash, as many unix programs.

    Do that help?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: