Lab 5: 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.

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 set the media path to your iPod directory?

Loading sounds in Java

Snarf the project labs/05_Sound. Open up the Sound.java file. Load the various sounds in the Interactions Pane. Bring up the SoundExplorer for each one. For example: > Sound s = new Sound(FileChooser.pickAFile()); > s.explore(); 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 lab5.

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.