Lab 6: Sounds

Reminder:
  1. Enable disk use on your iPod
  2. Bring your iPod, USB cable, microphone, and headphones to lab

Overview

In this lab, you will start using the media classes provided to us by Barb Ericson at Georgia Tech.

Transferring files from your iPod

Read the instructions for transferring audiofiles from your iPod. Remember where you put all of the files and how you can navigate to them.
Note: If you have trouble getting the sounds off your iPod, then use these sound files provided from another student.

Learning about the Sound class

An Application Programming Interface provides an abstraction for a programmer who is going to use some library or software. You will need to look at APIs in order understand and use libraries. We Answer the following questions in a text file notes.txt.
  1. Using the Java API, find the API for the Applet class and explain what the init method does.
  2. There are two different substring methods in the String class. What is the difference between the two?
  3. What method in the Sound class in the mediaClasses returns the number of samples in a particular Sound?
  4. How can you use the FileChooser class to determine and/or set the media path to your iPod directory?

Loading sounds in Java

Snarf the project labs/06_SoundLab. Open up the Sound.java file. Switch the perspective to Dr. Java by clicking on the button to the left of the Java button in the top right. This will bring up the in the Interactions Pane where you will type.

Bring up each of the sounds in the SoundExplorer by typing the code below for each sound:

1 > Sound s = new Sound(FileChooser.pickAFile()); 2 > s = s.standardize(); 3 > s.explore(); This code above
1) creates a new Sound s
2) standardize takes your Sound and creates a copy that is one-channel (i.e. mono) audio sampled at 22.05 kHz.
3) brings up the Soundexplorer window

If you did all of the above successfully you should see a window like the picture below:

Answer the following questions in notes.txt:

  1. How do the waveforms for each sound differ?
  2. How do higher pitched sounds vary from lower-pitched ones?
  3. How do quieter sounds look different than louder ones? Does the change in amplitude values accurately reflect your perception of relative loudness?
  4. How does an electronic sound differ from one produced by a voice or instrument?
  5. What happens if you increase a volume too far? Explore by creating a Sound object, then increase the volume repeatedly. Does it always keep getting louder or does something else happen? Why?

Manipulating Sounds

Open up Sound.java and do the following:
  1. Complete decreaseVolume: halve the amplitude of a sound
  2. Complete changeVolume: change the amplitude of a sound by some factor

Submitting

Submit your Sound.java and notes.txt files using Eclipse. See the Ambient submit instructions. You should submit under class cps001, assignment name lab06.

Transfer any modified sounds back onto your iPod (using the write method in the Sound class), so you can listen to them and check that you did indeed change the volume, for example.