October 31, 2006 2:14 PM

Session 18

Welcome back! Oh, wait, I am the one who returned. It's good to see you all again.

Today, we returned to playing with sounds, especially the additive behavior of sounds waves. Adding sound samples arbitrarily doesn't do much for us, but using variations on the theme leads to interesting effects, like blending, chording, and echoes.

Here are the slides (PDF) I used and a script of some of our Dr. Java interactions, and the Sound.java file that we produced.

I didn't tell you much about my week at OOPSLA, today, but we will have an opportunity to discuss some of my activities next week, when we step back from images and sounds to talk about our programs at a higher level.

As is now our pattern, please take a pair of headphones with you to the lab tomorrow, if you have them.

Finish reading Chapter 10 of the textbook for our next session. Your next homework assignment won't come out until then.


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 19, 2006 4:06 PM

Homework 5: Assembling and Disassembling Sounds

This assignment consists of two tasks. Put both methods in the same Sound class, along with any helper methods you create.

Task 1

In Program 74, Guzdial and Ericson splice the word "united" from later in the preamble to the Constitution into the earlier phrase "We the united people...". Let's emphasize that word by making it maximally loud for the sound file.

Modify the method to normalize the spliced-in "united" in "We the united people...".

Task 2

Compose a sentence that I never said using the sound clip of The Voice of CS I. That sound file has a lot of empty space and white noise in it, so there is plenty of room for you to rearrange words around, splice words in, and otherwise "doctor" the audio.

Write a method named doctorTheVoice() that loads that sound file using getMediaPath(), modifies it, and returns the modified sound as its result. Make at least three different changes to the sound. You may use words from the mediasources folder, the clipped but high-pitched version of my voice, or even words you record on your own. But the bulk of the result should be my words.

Be sure to include a pause between words so that we can hear them distinctly. (I suppose that running a couple of words together could for an interesting effect, so I'll give leeway where the sound is interesting!) 1/10 of a second is usually a reasonable pause. Recall that sample values of 0 generate silence.

For example, I applied....

How We Will Grade Your Assignment

This assignment is worth 20 points.

We will...

  1. ... retrieve your submission from the submission system.
  2. ... put your Sound class into the bookClasses directory and all of your sound files into another folder.
  3. ... set the media path to the folder containing your images, using setMediaPath().
  4. ... open your Sound class in Dr. Java.
  5. ... execute these commands from the Interactions pane.
  6.     String silence = FileChooser.getMediaPath( "sec3silence.wav" );
        Sound  target  = new Sound( silence );
        target.splicePreamble();
        target.play();
    

    Sound theDoctorsVoice = silence.doctorTheVoice(); theDoctorsVoice.play();

  7. ... listen to your sounds.
  8. ... look at your sounds using the explorer.

Deliverables

By the 8:00 AM on Tuesday, October 31, submit these files:

  • Sound.java
  • any sounds you use to doctor my voice file
  • the new sound file you created using splicePreamble().
  • the new sound file you created using doctorTheVoice().
following the submission instructions for the course. You do not have to submit printouts of your sounds. :-)


Posted by Eugene Wallingford | Permalink | Categories: Homework

October 19, 2006 2:28 PM

Session 17

Today, we played a lot with sound, including generating some mathematical curves and listening to them as sounds and answering some open questions from past sessions. Here are the slides (PDF) I used and a script of some of our Dr. Java interactions, and the Sound.java file that we produced. You can also have the recordings of my own voice via this zip file.

Recall that we do not have class next week, as I will be on the road at OOPSLA, the best conference around on programming and programs. (Check out who's in charge of the tutorials track...)

You can use the open class time to study, program, or catch up on lab exercises. TA Mike Volz will hold lab hours during our regular class time, 12:30 PM-1:45 PM on Tuesday and Thursday, in 339 Wright. He can answer questions and generally help you catch up or move forward. His lab schedule for the week will be:

  • Monday, 6:30-8:30
  • Tuesday, 12:30-1:45
  • Wednesday, 2:00-3:30
  • Thursday, 12:30-1:45 and 6:30-8:30

You will have lab as usual -- don't forget to take a pair of headphones with you if you have them.

Read Chapter 10 for our next session, October 31. And solve Homework 5 -- it is due on Halloween as well!

I'll be in e-mail contact next seek, so drop me a line. I'll try to enjoy rainy Portland, Oregon!


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 17, 2006 4:17 PM

Session 16

Today, we discussed a solution to Homework 4 and then moved on to more sound manipulation, including "posterizing" (with sound, known as "clipping"), making a sound clip, and increasing/decreasing a sound's volume in a linearly increasing/decreasing way.

Here are the slides (PDF) I used and a script of some of our Dr. Java interactions, and the Sound.java file that we produced. You can also have the recordings of my own voice via this zip file. Now, if you ever feel the need to hear my soothing voice, you can -- speaking through Dr. Java or your own mp3 player!

Read the rest of Chapter 9 for our next session. And don't forget to take a pair of headphones with you to the lab tomorrow.


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 12, 2006 2:10 PM

Session 15

Today, we discussed some basic operations on sounds, and learned that our -- well, at least my -- intuitions about how sound works are not so good. We reminded ourselves of something we learned last time, intellectually at least: that human perception of sound is about ratios, not absolute values. Experimentation will help all of us develop better instincts.

Here are the slides (PDF) I used and a script of some of our Dr. Java interactions, and the Sound.java file that we produced.

Read the first half of Chapter 9 or so for our next session. Again, notice how much of the Java we use for sound processing resembles the Java we wrote to process images.

And keep working on Homework 4, which is due next Tuesday, 8 AM.


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 10, 2006 3:56 PM

Session 14

Today, we finished off our main discussion of images with a quick look at "chromakey", or the use of background subtraction to replace the background of a picture. Then we moved onto our next unit -- sound -- and considered both same basics of representation and some Java. Oh, and we discussed the results of the first exam a bit.

Here are the slides (PDF) I used and a script of some of our Dr. Java interactions. We used three different Java files today, a Picture class with code snippets from the exam, a Picture.java file for chromakeying on blue, and a Sound.java for learning some basic sound manipulations -- and two bonus methods by yours truly.

Read deeply into Chapter 8 for next session. Notice how much of the Java we use resembles what we wrote for manipulating images! Be sure to play with the code as your way to understand the encoding of sound samples.

And keep working on Homework 4, which is due a week from today. It should be fun -- and even has opportunities for extra credit!


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 05, 2006 2:42 PM

Homework 4: Making Your Own Comic Strip

Quick Overview

Your task this week is to write a method that creates a comic strip using pictures of your choosing. The strip must have at least four frames in it. Here is a sample, a two-frame comic strip from the authors of our textbook.

After deciding on images and a theme, you will want to plan ahead a bit, to design the layout of your comic strip. Here is an example of the planning that the authors did while creating their sample strip.

Details, Details

  • Download and use the file ComicStrip.java for your assignment. Your job is to "fill in the blank" in the method named createStrip().
  • Your createStrip() method should take NO arguments as input.
  • You may make the strip as big as you would like, but try to keep it as small as possible in to eliminate excess white space in the background.
  • Your comic strip must consist of at least four frames. You may lay them out as 4 in a row horizontally, or 2x2 in a square, or 3x3 -- however you. wish. The frames must be separated with lines.
  • The strip must consist of at least two characters, whose images are taken from one or more files.
  • At least one frame must have a caption, something that someone is "saying".
  • At least one character must appear in two or more frames.
  • The character that appears in two or more frames must be modified in some way in one of those frames:
    • cropping the image (for example, showing just the eyes after showing the face)
    • resizing the image
    • rotating or mirroring
    • manpulating the color values
    • etc...

  • You must write at least two helper methods that are called by "createStrip() to do its job. For example, you might have a method that copies an image to a location specified by (x,y) arguments, or you might have different methods for the various modifications you make to the characters' images.
  • Your function must retrieve the image files it uses from the directory specified by the media path. To do this you must use getMediaPath(). You must not use setMediaPath() or pickAFile() in your solution.
  • Do not use show() or repaint() inside your method. (If you want to do so while your are coding, fine, but be sure to remove those lines before you submit your program.)
  • After you are done, use write( filename ) in the Dr. Java Interactions pane to save your comic strip as an image file. (Your createStrip() method must not use write( filename ).)

How We Will Grade Your Assignment

This assignment is worth 30 points.

We will...

  1. ... retrieve your submission from the submission system.
  2. ... put your ComicStrip class into the bookClasses directory and all of your images into another folder.
  3. ... set the media path to the folder containing your images, using setMediaPath().
  4. ... open your ComicStrip class in Dr. Java.
  5. ... execute these commands from the Interactions pane, using the width and height specified in your class's header comment.
  6.     ComicStrip comic = new ComicStrip( width, height );
        comic.createStrip();
        comic.show();
    
  7. ... look at your picture.

Extra Credit Opportunities

If your comic strip makes sense -- that is, isn't just a bunch of pictures thrown together, but actually "tells a story" -- then you will eligible for two (2) extra-credit points.

If your comic strip uses a background picture from some image file in at least one of the frames, then you will be eligible for four (4) extra-credit points.

Deliverables

By the 8:00 AM on Tuesday, October 17, submit these files:

  • ComicStrip.java
  • all of the images you use to build your comic strip
  • Picture.java, if you use one in your solution
  • the comic strip that you created
following the submission instructions for the course. Note that you do not have to submit printouts of your images, but you must submit them electronically. Note that you must submit your program both electronically and as a print-out -- of the whole file!


Posted by Eugene Wallingford | Permalink | Categories: Homework

October 05, 2006 2:27 PM

Session 13

Today, we played a bit with loops and their control elements. Our coolest product was a method to draw blank Sudoku grids. At this point, the method uses hard-coded values. A great exercise for your home study is to parameterize the method so that it can create grids of any size!

Here are the slides (PDF) I used and a script of some of our Dr. Java interactions. We produced a version of Picture.java that creates this sort of blank grid. (I also showed you a quick-and-dirty program to turn numbers of seconds into strings. Use at your own risk!)

Begin reading Chapter 8 for next week. We may spend a few minutes looking at Chapter 6 chromakey technique, but we are ready to move on to processing sound!

Homework 4 is available now and will be due a week from Tuesday. It is worth a few more points -- and will take a bit longer than our previous assignments. So don't use the later deadline as an excuse to delay your start...


Posted by Eugene Wallingford | Permalink | Categories: Sessions

October 03, 2006 2:11 PM

Session 12

The main event today was our first exam, but we did spend a few minutes talking about Homework 3 and a lesson a few of you learned about just how long a seemingly simple method can take. As usual, I have these materials for you from class: the slides (PDF) I used and a script of some Dr. Java interactions, and a version of Picture.java that we used in our exercise.

In the lab tomorrow, you will work with some of the fun graphics material from Chapter 7. In class on Thursday, we will talk about one remaining idea from Chapter 6 -- greenscreening -- and wrap up a bit of graphics. Next week, we will move on to processing sound!

With Homework 3 due today and Exam 1 today as well, I'll give you a short break from programming. Homework 4 will probably come out on Thursday.


Posted by Eugene Wallingford | Permalink | Categories: Sessions