CS 101 - Introduction to Computing, Spring 2010

Lab 14

For this lab, you are to take a sound object and recreate the effect of "scratching" used by Hip-Hop DJ's. This is when the DJ uses a turn-table and quickly moves the record backwards and fowards a few times.

Here are some good files for the base sound:

For this lab, about 3-5 seconds into the playing of the sound, you are to add a scratch effect, after the scratch effect is over play another 3-5 seconds of the original sound.

The scratch effect should be done as follows:

  1. About 3/10ths of a second of the sound played quickly forward
  2. The same amount of the sound played quickly backward
  3. Steps 1 and 2 repeated two more times.
The scratch effect should have sound played at more than double speed (triple speed should be good). To "play" a sound at a faster speed, we copy over only some of the sound samples. If we copy every other sound sample we get a sound at double speed (which is what was done on Lect420b.java when we doubled the pitch of a sound). If we copy every third sample, we triple the speed of the original sound.

To "play" a sound backward, we must reverse the sound as was done in Lect48d.java. Of course there we reversed the entire sound instead of just a small part of the sound.

Lab Assignment 14

Due: Thursday 4/29/2010 by 11:59 pm

Create a Java program that will:

  1. Contain a comment indicating

  2. Contain the main() method that will

  3. The method addScratch ( ) is to:
    1. Have about 3/10ths of the sound played quickly forward (at about triple speed)
    2. The same amount of the sound played quickly backward (at about triple speed)
    3. Repeat steps 1 and 2 two more times
Here are some example sound files you can use with this assignment.

Submittal of the Lab Assignment

  1. Go to the blackboard site for the class
  2. Select "Assignments" on the left bar
  3. Locate the correct assignment to submit; click on "View/Complete Assignment" at the bottom of that assignment
  4. Next to "Attach local file", click "Choose file", choose the file you want to submit; please submit only ONE file, properly named.
    For example for lab2, name it Lab2yournetid.java, for example if your Net ID is sfranz3, the filename would be Lab2sfranz3.java
    Please only submit source code file (the .java file, not the .class). Also, if you have any comment about your program, please write it down in the same file; please do NOT write in the "Comments" field on the submission page (this will go into a different file and will be easily missed).
  5. Hit "Submit"
  6. Go back once again to View/Complete assignment and make sure that your file was submitted; also, this page will show your grade and comments (if any) after assignments are graded.