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.
- Using the Java API, find the API for the Applet class and explain what
the
init method does.
- There are two different substring methods in the String
class. What is the difference between the two?
- What method in the Sound class in the mediaClasses returns the number
of samples in a particular Sound?
- 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:
- How do the waveforms for each sound differ?
- How do higher pitched sounds vary from lower-pitched ones?
- How do quieter sounds look different than louder ones? Does the change
in amplitude values accurately reflect your perception of
relative loudness?
- How does an electronic sound differ from one produced by a voice or
instrument?
- 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:
- Complete decreaseVolume: halve the amplitude of a sound
- 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.