CS 111 - Programming Design I, Spring 2014

Lab 12

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 Lect0417c.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 Lect0415d.java. Of course in this code, we reversed the entire sound instead of just a small part of the sound.

To help with this lab, you may wish to look at the code in Lect0417b.java. This code has a method that will "create a sound bite". It copies part of a Sound object into a new Sound object.

You may also wish to check out the code in Lect0417a.java. It will take two Sound objects and combine them together by appending the second to the end of the first.

Lab Assignment 12

Due: Wednesday 4/23/2014 by 11:59 pm

Create a Java program that will:

  1. Contain a comment indicating
    • your Name,
    • Net-ID,
    • Course Name,
    • Assignment Name and
    • a short description of the assignment

  1. Contain the main() method that will
    • Prompt the user for a sound file and make a sound object from this file.
    • Create 3 new sounds objects from parts of this sound object
      1. The first 3-5 seconds of the original sound
      2. About 3/10th of a second of the original sound starting at the place where the first part ends
      3. Onather 3-5 seconds of the original sound starting at the place where the first part ends
    • Call the method createScratch( ) to create the Scratch Effect using the second part of the original sound as the base for the scratch effect.
    • Combine the first part, the created Scratch sound and the third part together
    • play (or explore) the resulting combined sound and prompt the user to save it in a file

  1. The method createScratch ( ) is to:
    • Take a sound object as its parameter
    • Return a newly created sound object that:
      1. Has the sound given by the parameter 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 for a total of 6 copies of the original sounds (3 played forward quickly and 3 played backward quickly)

How assignments should be submitted

You are also to submit the Java file electronically via the link in Blackboard.

Here are some example sound files you can use with this assignment.

-- Main.troy - 2014-04-21
Topic revision: r1 - 2014-04-21 - 14:43:44 - Main.troy
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
Helping Women Faculty Advance
Funded by NSF