by Adam Tindale
Navigate to the examples folder in the ChucK distribution then run the following command:
%>chuck moe.ckIn this case, ChucK will run whatever is in moe.ck. You can replace moe.ck with the name of
%>chuck moe.ck larry.ck curly.ckThey are written to go in and out of phase with each other. Again, if any of these scripts will go
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! This section will walk you through a ChucK session.
Here is what you do: open another terminal window just like this one. 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 test.ck %>chuck test.ck %>chuck test.ck
What happened? That is the power of on-the-fly programming. 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.
When you have had enough of ChucK you can go to the other window and use your fancy CTRL-C trick or you can type chuck - -kill in your original window.
%>chuck --kill
So you think you're pretty good? One window ChucK is only for the hardest of hardcore.1 You have been warned.
The concept is pretty similar to two window ChucK: first, you start a ChucK going, then you manage the adding and removal of scripts to it. How do you start a ChucK and get the command prompt to return, you ask? In your shell you can add an ampersand (&) after the command and that will tell the shell to run the command as a background process and give you the prompt back.
%>chuck --loop &
The rest is as it should be. You will have to be careful when writing your patches to not put too many print statements. When you print you will temporarily lose control of the prompt as the shell prints. This can be bad when are you are printing MIDI input. The same applies when you use the --status command to ChucK. It can also be fun to fight for your command line. Who will win?
Note that the "&" sytax is part of UNIX terminals like BASH, as found on Linux and OSX, and not a part of the MS Windows prompt.
There has been error in communication with Booktype server. Not sure right now where is the problem.
You should refresh this page.