ChucK/WinXP Install and Run

From CSWiki
Revision as of 19:24, 21 February 2006 by Gewang (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Getting Started with ChucK on Windows XP

by Adam Tindale (--art) + Ge Wang


The classic way to run ChucK is via Terminal/and the command line. If you haven't used the command line before, don't worry - you only need learn a few commands and can get a lot of mileage on those.


Getting ChucK Installed

  • You can start by downloading the ChucK binaries for XP from here! (Get the windows executable at the bottom right)
  • You will download a file that looks like chuck-1.2.x.x-exe.zip. Uncompress this with your favourite utility and you will have a folder called chuck-1.2.x.x-exe. (the x.x in this filename is the name of whatever version of ChucK you have on your system - chuck-1.2.0.0-exe for example )
  • If you want to install it (so it will be globally available), simply put the chuck.exe file in c:\windows\system32. The chuck.exe can be found in the bin folder of chuck-1.2.x.x-exe.
  • Keep the uncommpressed chuck-1.2.x.x-exe directory somewhere - we will access examples from this later in this tutorial.

From now on, we will assume the chuck-1.2.x.x-exe directory in C:\ (the root level directory of the C drive).

  • Make some space somewhere to give your ChucK scripts a home. Put all of the ChucK examples there. Now we are ready to put ChucK to work.


Starting and Using the Terminal

  • The terminal can be a pain. But it can also be fun to work with. Let's get started.
  • You may have seen the run command in the Start Menu. We are going to click on it. After that it is all typing, get ready:

1. Click on the start menu.

http://soundlab.cs.princeton.edu/images/here/start.jpg



2. Click on run.

http://soundlab.cs.princeton.edu/images/here/start2.jpg



3. A window will open. Type: cmd

http://soundlab.cs.princeton.edu/images/here/run.jpg



4. A new window should open that should something like this:

http://soundlab.cs.princeton.edu/images/here/cmd.jpg




5. If so, now we are in the terminal. If we want to move to your ChucK home we have to use the cd command, this is for changing directories (get it?). Once we get to your ChucK home we will move to the examples directory. The rest of the tutorial will be using the files that are included in the examples directory to get you up + chuckin'.

First, we will type cd c:\ to change to the root directory on drive C:

http://soundlab.cs.princeton.edu/images/here/cmd2.jpg


6. Next, type cd chuck-1.2.x.x-exe, replacing chuck-1.2.x.x-exe with the right version number. if you want to see what is in the current directory, use dir command.

http://soundlab.cs.princeton.edu/images/here/cmd2.5.jpg

In this case we have version 1.1.5.6., you may have something different...

http://soundlab.cs.princeton.edu/images/here/cmd3.jpg


7. You can type dir to list all of the files in this directory. Try it.

http://soundlab.cs.princeton.edu/images/here/cmd4.jpg


8. Now we need to get to the examples directory. Type cd examples

http://soundlab.cs.princeton.edu/images/here/cmd5.jpg


9. Now if you try to run ChucK no sound will be produced. ChucK will quit and give you a message. We will learn more about this later.

http://soundlab.cs.princeton.edu/images/here/cmd6.jpg


Good work. Next we will bring the noise!

Running ChucK in the Terminal

Alright. We are in the examples directory and you want to run ChucK from the terminal for the first time. To do so, type:

   chuck moe.ck

In this case, ChucK will run whatever is in moe.ck. You can, of course, replace moe.ck with the name of another ChucK file. If this script is a just a loop that never ends then we need to stop ChucK eventually. Simple press CONTROL-C (hold control and press c). This is the kill process key in the terminal. Where is the ChucK power that was promised to you?

You can add multiple copies of the same script if you like:

   chuck moe.ck moe.ck

Again, if any of these scripts will go on forever then you have to use the magic CONTROL-C to halt ChucK. Why would you do that? If the script has some random number generators or something like that then you end up with some nice ChucK chaos! Give it a try.

Some first things to try to test the concurrency (running multiple ChucK files in parallel) are moe, larry, and curly. To listen to moe.ck, larry.ck, or curly.ck together type:

   chuck moe.ck larry.ck curly.ck

They are written to go in and out of phase with each other. Also try the improved versions of our little friends:

   chuck moe++.ck larry++.ck curly++.ck


Digging Deeper

Now lets roll up our sleeves a little bit and see some real ChucK power! We are going to run two window ChucK, and on-the-fly!

Here is what you do: open another terminal window just like this one. Click on run in the Start Menu and type cmd in it; just like before. In this new window type chuck --loop

This will start ChucK running. ChucK is now waiting for something to do. Go back to your original window where you are in your ChucK home. Be careful. If you type chuck test1.ck you will start a second ChucK running test1.ck. What we want to do is add a script to the ChucK that we set running in our second window. We will use the + operator to add a script to our ChucK and the - operator to remove a script.

   chuck + test1.ck
   chuck - 1 
   chuck + test1.ck
   chuck + test1.ck
   chuck + test1.ck
   chuck - 1 2 3

What hapenned? That is the power. We added test1.ck. It was added as the first shred in our ChucK. Since we knew it was shred 1 we removed it by typing chuck - 1. Great. Next we added three copies of the same script! Isn't that cool? You can also do this chuck + test1.ck test1.ck test1.ck

How do you keep track of shreds? You can ask ChucK how he is doing by typing chuck --status

The shortcut is chuck ^

ChucK will answer in the other window where we left him running. He will tell you what shreds there are and what their id numbers are. He will also tell you how long he has been running. Great.

When you have had enough of ChucK you can go to the other window and use your fancy CONTROL-C trick or you can type chuck --kill in your original window.

Now go forth and check out the ChucK tutorial. Here it is!


--art