CS 111 - Introduction to Computing

Lab 13

In this lab, you will take the Sound File preamble.wav and create a new sentence from those words.

The sentence you are to create is:

We provide the common liberty to perfect people.

The entire text of the Preamble is:

We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.
Make sure the you include some break/silence between the words of your newly created sentence.

To break the original sound into word, we need to know the starting and ending indices of the words. According to page 300 in our text book, the following words from the beginning of the Preamble can be found at the given indices from preamble10.wav:

Word Starting
We 0 15,730
the 15,730 17,407
People 17,407 26,726
of 26,726 31,131
the 31,131 33,413
United 33,413 40,052
States 40,052 55,510

For this lab, you may want to use the code from

Lab Assignment 13

Due: Tuesday 11/26/2013 by 11:59 pm

Create a Java program that will:

  1. Be writen using good programming style which includes:
    • Using Multiple Methods
    • Good variable names
    • In-line commenting
    • Proper indentation of program statements
    • Use of blank lines to separate blocks of code.
    • Header block commenting for the program and each method written

      Your header block comment for the program must include the following:

      • Your Name,
      • Net-ID,
      • Course Name,
      • Assignment Name and
      • Day and time of your CS 101 lab section (i.e. Wednesday at 9:00)
      • A short description of the assignment.
Header block comments for each method must include the following:
      • A description of the purpose of the method
      • A listing of the name, type and purpose of every parameter
      • A description of the return value and its type

  • Contain the main() method that will
    • Get the soundtrack file preamble.wav
    • Create a sound object from the file
    • Split this sound into the needed words using the create sound byte method specified below
    • Join those words into the required sentence using the join sound method specified below
    • Play (or explore) the sound.
    • Prompt the user for a name and save it.

  1. Use at least two other methods:
    • One to create a sound byte from another sound
    • One to join two sounds together (one following the other)
  2. The create sound byte method is to take 3 parameters:

    • the original sound
    • the starting index in the original sound for the sound byte
    • the ending index in the original sound for the sound byte
  3. The create sound byte method must also verify that the parameter information is correct. If there is an error return a null value.
    • The create sound byte method must verify that the starting and ending indexes are valid for the length for the original sound (i.e. the value are NOT out of range)
    • The starting index must also be less than the ending index.
  4. You are also to submit the Java file electronically via the assignment link for Lab 13 in BLackboard.

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

-- Main.troy - 2013-11-21

Topic revision: r2 - 2013-11-21 - 17:53:04 - Main.troy
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
Helping Women Faculty Advance
Funded by NSF