PLOrk Asgn2 Details

From CSWiki
Jump to: navigation, search

Up and ChucKing!

  • Don't Panic (and have fun)!
  • If you have questions, email us directly or post to plork-175!


verifying preferences

Under 'System Preferences' and then 'Sound':

  • make sure edirol is the default output audio device
  • if you want to use the built-in mic for input, make sure 'built-in' mic is the default input device


volume control

To control volume, use the knobs on the 2-channel amplifier (DA-70-2).

  • This is really ghetto, and we hope to fix it soon.
  • We have found that a 9 o' clock setting (or less) is tolerable for the knobs.


hello ChucK

Open a Terminal from the dock. This starts in your home directory. For example, on the machine 'boom', the prompt may look like:

   boom:~ boom$

See if ChucK exists. Type 'chuck' in the terminal. You should see the following message:

   boom:~ boom$ chuck
   [chuck]: no input files... (try --help)

This is the correct behavior, it's simply telling us that we have not supplied any programs for chuck to run. If you like, you can see the help output by typing 'chuck --help':

   boom:~ boom$ chuck --help
   usage: chuck --[options|commands] [+-=^] file1 file2 file3 ...
      [options] = halt|loop|audio|silent|dump|nodump|about|
                  srate<N>|bufsize<N>|bufnum<N>|dac<N>|adc<N>|
                  remote<hostname>|port<N>|verbose<N>|probe|
                  block|callback
      [commands] = add|remove|replace|status|time|kill
      [+-=^] = shortcuts for add, remove, replace, status
   
   chuck version: 1.2.0.1 (dracula)
      http://chuck.cs.princeton.edu/

For now, you don't need to worry about any of these options. But this help output may be useful later on.


running examples

Let's run some examples and hopefully hear some sound. First, let's navigate to the examples directory. Don't worry if you haven't used a command line interface before - just remember: don't panic, it's easy once you get use to it. And we will be here to provide support.

To change to a directory, we use the 'cd' (change directory) commmand. For example, let's go to the examples directory.

   boom:~ boom$ cd PLOrk/chuck/week/02/examples/

Now the prompt should display that you are there:

   boom:~/PLOrk/chuck/week/02/examples boom$

You can also find out where you are by typing 'pwd' (I have no idea what this stands for) and you can you move to the home directory by simply typing 'cd' or 'cd ~' (the ~ represents path to your home directory).

Now, let's see what files are in the current directory by typing 'ls' (for uh list I think):

   $ ls
   (you should see a list of files)

Okay! Let's play something. Type 'chuck' followed by the name of the program you want to run. For example:

   $ chuck foo.ck

(or simply):

   $ chuck foo

(the .ck is automatically appended)

You should be hearing the unmistakable sound that computers make (in the old SCI-FI movies).


stopping chuck

Some programs go on indefinitely. To stop them, hit 'ctrl-c'. Hopefully chuck will actually stop. If not, turn down the volume and hit 'ctrl-c' a couple more times.


running programs in parallel

ChucK is a current programming language, which means you can run different parts of a program in parallel. For example, if we listen to moe.ck, larry.ck, and curly.ck separately:

   $ chuck moe
   (hit ctrl-c to stop)
   $ chuck larry
   (hit ctrl-c to stop)
   $ chuck curly
   (hit ctrl-c to stop)

We hear them individually. We can also tell chuck to run them in parallel:

   $ chuck moe larry curly
   (hit ctrl-c to stop)

This should play them "together". Without necessarily understanding any of the code, can you guess why they sound the way they do when played together? (hint: moe larry and currly and nearly identical except for one or two differences)

(to see/edit the files, use 'pico' or 'plork_edit')

   $ plork_edit moe.ck

Try a few more examples, and take a glance at the code - don't worry about understanding the code, we will learn ChucK step-by-step later.

making sounds:

   $ chuck foo
   $ chuck whirl
   $ chuck moe
   $ chuck larry
   $ chuck curly

concurrency:

   $ chuck moe larry curly
   $ chuck otf_01
   $ chuck otf_01 otf_02 otf_03 otf_04
   $ chuck otf_01 otf_06
   $ chuck otf_0* 

file playback:

   $ chuck sndbuf

no sound (but useful):

   $ chuck demo0    (shows timing)
   $ chuck demo1    (shows loops)

using mic:

   $ chuck adc (speak into mic)
   $ chuck i-robot (speak into mic)
   $ chuck ring.ck (speak into mic)

some STK instruments:

   $ chuck rhodey
   $ chuck shake-o-matic
   $ chuck mode-o-simple
   $ chuck mandolin
   $ chuck mand-o-matic
   $ chuck band-o-matic


resources