Thursday, May 31, 2012

Reactions by Jan

After three days of reviewing tutorials and creating burps and hiccups and strangely cooing noises from the computers, today we concluded with a full do-re-mi of frequencies.  The experience has caused me to be more in tune with the ambient sounds around me throughout the day.  Computer music programming comes from

C Major Scale - I Think (aka Julia's First Scale)

Click "Read More" to view the code for (I think it's) the C Major Scale (the first draft, because this code is too freakin' long), aka Julia's first scale :)


Thoughts/Brainstorming on Real-World Musical Creation with ChucK

//this post is just my own thoughts after having spent a couple days working with ChucK. I may update it in the future, or if I have new ideas after talking about these points with the other members of the group. Also it turned out very long. Sorry!

     I don't entirely understand the point of computer music.

miniAudicle Manual


The manual is located here.  MAUI Elements gives you options to use/build graphical interfaces as these examples show below
http://audicle.cs.princeton.edu/mini/mac/doc/


Saving to .wav files

The thrill of playing the music you composed in ChucK many days later when you have probably forgotten much about chucking, or just sharing your compositions with friends and family, is just a thrill everyone should experience. It is not hard at all to save your compositions in ChucK. Please note that I am assuming that you are using the command line. Let's dive right in.
  • In your ChucK folder—the one you downloaded when you were installing the command line ChucK,  double-click on the examples folder
  • A bunch of other folders and .ck files will appear. Look for the basic folder, and  double-click it
  • You will see rec.ck and rec-auto.ck files. These are the files you need for saving your compositions to .wav files
  • Now make a choice, yes make a choice. Do you want to save your .wav files in the basic folder or somewhere else. If you don't mind saving them in the basic folder, use cd on the command line to access the current directory. I assume you understand how to access files and folders from the terminal by now. Besides, you can always use ls to see the files and folders you have access to right now
  • If you would like to save your .wav files somewhere else, you might want to consider copying and pasting your rec.ck and rec-auto.ck files to the location where you would like to save your .wav
  • Make sure in your terminal you are in the right folder—the exact folder where your rec.ck, and rec-auto.ck are located—where you would like to save your .wav files
  • Let's save the composition
    •  If you would like to save the following : chuck chuck1.ck you should type chuck chuck1.ck rec.ck in the terminal
    • If you would like to record your composition but don't hear the sound while it is recording, type chuck chuck.ck reck -s. The -s is the one which is used for recording in silence
    • rec.ck records a .wav file with the name foo.wav, but in the event that you would like to record many other compositions and you do not like  the foo.wav to be overwritten, you can use rec-auto.ck. So if you would like to record the following composition: chuck chuck1.ck chuck2.ck chuck3.ck, then you need to type chuck chuck1.ck chuck2.ck chuck3.ck rec-auto.ck, and if you would like the recording to proceed in silence, type chuck chuck1.ck chuck2.ck chuck3.ck rec-auto.ck -s
    • Please note that you can always change the file names later, and also check the rec.ck and rec-auto.ck files  to see if you can change anything in those files

Hardcoded class of musical notes

Here is a class I've written using the chart located on this page: http://www.zytrax.com/tech/audio/audio.html#notes. The explanation in the comments should hopefully be sufficient to understand how to use it. It should be helpful for anyone wanting to work with creating music in ChucK. I may in the future add some scales to it, but since there is such a wide variety
of scales available in music it would probably be more efficient for those to be added by the individual. For scales, using an array would probably be the best way to go. The code is below the jump.


ChucK Manual

  • If you download the command line ChucK, you can easily access the ChucK manual by going to the location where your ChucK  folder you have just downloaded is. By default, it is usually saved in the downloads, but depending on your settings, it might be stored on the Desktop or somewhere else. You can also move the folder to where you would like to access it from
  • Double click on the ChucK folder
  • Three other folders and a bunch of other files will show up, but double click on the doc folder now
  • Double click on the ChucK manual in order to open it. Congratulations you have just accessed the handy ChucK manual—your key to becoming a ChucK-pro

SUGGESTION BOX - Thoughts

This is a place for random ideas, comments, et cetera that we can expand into separate posts later.

Wednesday, May 30, 2012

The Basics (for PC) - Downloading ChucK for someone who has never even heard of "PuTTY" or "Command Prompt"

I am a Mac person, but I will do my best to make this PC tutorial easy to follow and (arguably more important) accurate...


Downloading the files from the site


So, just as in the Mac tutorial, before you begin trying to download ChucK on your PC, you must be able to open up the PC version of the Terminal: Command Prompt or PuTTY (I guess PuTTY is external software, and I have no idea what the difference is between it and Command Prompt, but luckily that isn't the point of this post). For the remainder of this post, I will give instructions for Command Prompt, but they should work on PuTTY as well.


Command Prompt (CP from here on out) can be found by clicking "Start > All Programs > Accessories > Command Prompt". Again, once all students have located CP, it's up to the professor whether she wants to use Smith accounts or not. This tutorial will once again assume no accounts are used, however (if they are used), the steps will be identical except for the different directory names.


You should download the PC executable version of ChucK from this link: http://chuck.cs.princeton.edu/release/. The executable version can be found in the Windows section of the page. Directly underneath this link is the PC miniAudicle download. Students should also download this link, but (for clarity) only after they are done downloading the executable version.

A folder should now pop up called: chuck-1.2.1.3-exe[1]. Drag and drop its one folder - "chuck-1.2.1.3-exe" - to the Desktop, and click "OK" if a warning message pops up.

PART I: Making it work on Command Prompt

1.) Open Command Prompt. 

**IMPORTANT: Notice that the line which pops up (with the blinking cursor) says "C:\Documents and Settings\Your Name" (and, obviously, Your Name is replaced with whatever your name is). This is important for accessing the right folders (aka "directories") later. If you ever find that the line you're typing on does not begin with this series, simply type in "cd C:\Documents and Settings\Your Name". If you forget this, you will most likely get an error notice saying that the specified folder/directory does not exist.**

2.) Type in "cd Desktop" and press enter. This is CP's version of accessing the Desktop. To see all of the files on the Desktop, type in "dir". A very cryptic list of all files and folders will appear, and (somewhere in it) you should see the name chuck-1.2.1.3-exe.
3.) Type in "cd chuck-1.2.1.3-exe" to open this folder. You can type in "dir" again if you're curious about what files/sub-directories are in this folder.
4.) Type in "cd bin". For future reference, you can type in "cd Desktop/chuck-1.2.1.3-exe/bin/" to do steps 2-4 in one step.


**The rest of this tutorial is reiterating the Install instructions found here.**


5.) Type in "move chuck.exe C:\windows\system32\" with a single space between each part. If you did this right, no error or warning messages should pop up.


6.) Everything should now be ready to go on CP! Here are two checks I suggest doing to see if everything is in working order:
  1. Type in "chuck" in any directory. The easiest way to get to other directories is to type in "cd ../". You should get the following output no matter which directory you are in:
    [chuck]: no input files... (try --help)
    
    
  2. Go back to the "chuck-1.2.1.3-exe" folder. If you are still in the "bin" directory, just type "cd ../". If you are elsewhere, type "cd ../" until you get back to: "C:\Documents and Settings\Your Name", and then type in "cd Desktop/chuck-1.2.1.3-exe".
  3. Type in "cd examples" to open the examples directory.
  4. Type in "chuck otf_05.ck". You should hear random tones generated by this ChucK program.

Part II: Downloading the miniAudicle

1.) Click on the PC miniAudicle download on the http://chuck.cs.princeton.edu/release/ page. When you are redirected, click the "download miniAudicle-0.2.0" link at the bottom. When prompted to open or save the file, open it, and a folder should pop up named "miniAudicle-0.2.0[1]". Drag and drop its one folder - "miniAudicle-0.2.0" - onto the Desktop, and click "OK" if a warning message pops up.
2.) Open the folder, and move the icon that looks like this: "=>" in green with an orange square outline - named "miniAudicle" - onto the Desktop (or wherever is best for you to easily access it).
3.) Open up the icon you just moved.
4.) Test it out with one of the example programs from the Chuck Folder. To do this, click "File > Open" and find the examples in your Chuck Folder (this is folder you put on your Desktop). Open any one (or more!) ChucK files that you like.
6.) Back in miniAudicle, click "ChucK > Start Virtual Machine", if the virtual machine hasn't already popped up.
7.) In each of the example ChucK files you opened, click the "Add Shred" button locted at the top left (it's a green plus sign).
8.) If you did it right, you should hear the random tones!




That should cover everything you need to know about downloading ChucK on a PC. If you have any questions, ask your professor/a teaching assistant to help you.


-Julia







Judy's Original Course Outline

Section One
    Sound waves, sampling, digital-to-audio conversion, wavetables.
    Recording/Sampling hardware.
    Recording/Sampling software.
    Analog-to-Digital Conversion
        Process, Hardware, Software
    Intro to Music Programming

Section Two:
    Making sound with sine waves.
    Harmonization.
    Timing.
    Making melodies.
    Randomization as a tool.

Section Three:
    Synthesis in more depth
    Granular Synthesis
    Synthesis from sine waves
    Synthesis from Wavetables
   

Section Four:   
    OSC (Open Sound Control) – internet based sound interaction format.
    Experiments in interactive synthesis.

Section Five:
    Designing interaction of synthesizers, timing.

Section Six:
    Focus on Final Project – One or more clusters of student groups

Section Seven:
    Final Project – demonstrations, department “performance”

Lab Idea 1: Intro to ChucK for Non-Programmers

Here's an idea for a lab for a class to do. It doesn't assume anything beyond a basic knowledge of how computers work and attempts to explain the basics of ChucK to someone who's never programmed before, while hopefully also giving some ideas for more advanced students to explore. Content is below the jump.


The Basics (for Macs) - Downloading ChucK for someone who has never even heard of "The Terminal"

Downloading the files from the site

So, clearly, to begin working with ChucK, one needs to download it. This might be complicated for someone who has never worked with the Terminal before. So I'm going to try to spell this out as best I can, in simple terms.

To start, we need to find the terminal. It might be best for students to keep the shortcut to it on the dock, or on their desktop. The terminal is located in the Utilities folder.

Once the students have all located the terminal, it is up to the professor to decide whether she will use Smith accounts, or just have the students log in normally. This post will assume she is not using the accounts, however (if they are used), the steps will be identical except for the different directory names.

The students should then download the executable version of ChucK from this link: http://chuck.cs.princeton.edu/release/. The executable version can be found in the MacOS X section of the page. Directly underneath this link is the miniAudicle download. Students should also download this link.

Two files should now appear in the Downloads folder: chuck-1.2.1.3.tgz and miniAudicle-0.2.0a.dmg.

PART I: Making it work on the terminal

1.) Click on the file chuck-1.2.1.3.tgz
2.) Somewhere in the Downloads folder, another folder titled chuck-1.2.1.3-exe should appear

3a.) At the date of this post, the ChucK files you download from this link are not completely compatible with MacOS Lion. There is a fix for this:
  1. Copy and paste this link into your browser: https://lists.cs.princeton.edu/pipermail/chuck-users/2011-August/006329.html
  2. Click on the first link on the page ( ChucK (Mac OS X Universal command line executable): https://ccrma.stanford.edu/~spencer/chuck/chuck-1.2.1.4-beta-1.tgz )
  3. That file (chuck-1.2.1.4-beta-1.tgz) should now appear in the Downloads folder
  4. Click that file. Somewhere in the Download folder (depending on the amount of files in it, students might have to look around for it) an icon that looks like a black screen with green writing in the top left corner should appear, with the name "chuck". **This is identical to the icon/file in the "bin" folder which is inside of the chuck-1.2.1.3-exe folder (I'll call this the "Chuck Folder" from now on), except that it has a patch that fixes the bug.**
  5. Expand the Chuck Folder inside of Downloads by clicking the grey arrow next to its icon. Now, underneath the Chuck Folder, all of the sub-folders (aka sub-directories) should be visible, including one called "bin". If you expand bin as well, by clicking the grey arrow next to it, you should see the original "chuck" icon/file I mentioned in step 4.
  6. Drag the icon which appeared in step 4 (the one with the patch) into the "bin" folder you just expanded. Make sure this file is named "chuck", and not "chuck 2" or "chuck 3" etc. If you do this right, a message will pop up asking if you'd like to replace the original "chuck" file. Click "replace" (or the equivalent to "yes").
  7. You will know if you did this right only after you finish the rest of the steps in this part. Don't worry if you didn't - you are able to go back and make it work later, too.
3b.) Bring up the terminal.
4.) Type in "cd Downloads" and press enter. This is the terminal's version of opening the finder and clicking on the "Downloads" folder. To see all of the files in the folder, type in "ls". You should see the name chuck-1.2.1.3-exe somewhere in the list of files.
5.) Type in "cd chuck-1.2.1.3-exe" to open this folder. You can type in "ls" again if you're curious about what files/sub-directories are in this folder.
6.) Type in "cd bin". For future reference, you can type in "cd Downloads/chuck-1.2.1.3-exe/bin/" to do steps 4-6 in one step.

**The rest of this tutorial is reiterating the Install instructions found here.**

7.) Type in "sudo cp chuck /usr/bin/". You should be prompted for your password, along with a warning message. Ignore the message, and type in your password.
8.) Type in "sudo chmod 755 /usr/bin/chuck". If you're prompted for your password again, type it in.
9.) Everything should now be ready to go on the terminal! Here are two checks I suggest doing to see if everything is in working order:
  1. Type in "chuck". You should get the following output: 
    [chuck]: no input files... (try --help)
    
    
  2. Go back to the "chuck-1.2.1.3-exe" folder. If you are still in the "bin" directory, just type "cd ../". If you are elsewhere, type "cd", then "cd Downloads/chuck-1.2.1.3-exe".
  3. Type in "cd examples" to open the examples directory.
  4. Type in "chuck otf_05.ck". You should hear random tones generated by this ChucK program. If you do, congratulations - you did it! If you don't, and you have MacOS Lion, you probably didn't copy the "chuck" file with the patch properly. You should retry the steps in 3a, or ask the professor/a teaching assistant for help.
Part II: Downloading the miniAudicle

This part will be a lot easier that Part I.

1.) Click on the file miniAudicle-0.2.0a.dmg which should still be located in your Downloads folder.
2.) If you get a warning message about it being an application downloaded from the internet, ignore the warning and open the package anyway.

3a.) IF YOU ARE NOT RUNNING MacOS Lion:

A device with the name "miniAudicle-0.2.0" should pop up (if it doesn't, look for it in the "Devices" section of the finder - in the side bar on the left). Drag and drop the "miniAudicle" icon inside the device folder onto your Desktop or the Dock

3b.) IF YOU ARE RUNNING MacOS Lion:
  1. Copy and paste this link into your browser: https://lists.cs.princeton.edu/pipermail/chuck-users/2011-August/006329.html
  2. Click the second link on the page ( miniAudicle (Mac OS X Universal binary): https://ccrma.stanford.edu/~spencer/chuck/miniAudicle-0.2.1-beta-1.tgz )
  3. That file (miniAudicle-0.2.1-beta-1.tgz) should now appear in the Downloads folder
  4. Click on it. Somewhere in the Downloads folder, an icon that looks like this: "=>" in green with an orange square outline should appear, with the name "miniAudicle".
  5. Drag and drop this "miniAudicle" icon onto your Desktop or the Dock
4.) Open up the icon you just moved.
5.) Test it out with one of the example programs from the Chuck Folder. To do this, click "File > Open File" and find the examples in your Chuck Folder (this is the same folder as step 9.3 above). Open any one (or more!) that you like.
6.) Back in miniAudicle, click "ChucK > Start Virtual Machine"
7.) In each of the example ChucK files you opened, click the "Add Shred" button locted at the top left (it's a green plus sign)
8.) If you did it right, you should hear the random tones. If don't, and you have MacOS Lion, you probably didn't open the patched version of miniAudicle. You should retry the steps in part 3b, or ask the professor/a teaching assistant for help.

That should cover everything you need to know about downloading ChucK on a Mac. The PC tutorial is coming next.

-Julia


GROUP NAME OPTIONS

SMaCKs  Smith Chuckers    - Jan

Learning ChucK: The Goals

This blog was created by and for Judy Franklin's Summer 2012 Research Assistants. We are exploring a (relatively) new Audio Programming Language: ChucK, with the goal of designing an introductory level Computer Science course for Smith College, as well as finding applications for the language in Judy's existing machine learning code/research.

We aim to track our own learning of the language in order to design a class for students with no prior programming experience.

~Smuckers (Smith Chuckers - tentative)