Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 9: Sounds Lab 9: Sounds Overview In this lab, you will start using the media classes provided to us by Barb Ericson at Georgia Tech. Part 0: 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 Java API mediaClasses API Answer the following questions in a text file notes.txt. 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 and/or set the media path to a directory containing your sound files? Part 1: Basic Sound manipulation Snarf the project labs/09_Sound. 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: 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? Write code for the following question. Open up Sound.java and complete changeVolume so that it changes the amplitude of a sound by some factor Part 2: Appending sounds Complete the apprend method in Sound.java that takes appends a Sound to the current Sound. The header for such a method would look like: /** * Method to create a new sound by appending another Sound to * the current sound. Assume that both sounds have the same * smapling rate * @param other the Sound that should be added to the end of this sound * to create a new one * @return a new sound which is the concatenation of the Sound passed in * and the original Sound */ public Sound append(Sound other) { } Extra Credit: Creating an Audio Collage Using the clip method from class and the append method you just wrote, arrange bits of sounds together to form an audio collage. You audio collage must: Include at least three different sounds (from different sound files) Be at least 5 seconds long and no longer than 1 minute long Include multiple parts from the same clip You may use any sounds referenced in Introduction to Computing and Programming with Java: A Multimedia Approach or other .wav files that you can find. Make sure you call the standardize method on each sound that you use. You can use mirroring, splicing, volume manipulation, or any other technique from class or the book to jazz up your sounds. Particularly good collages may receive extra extra credit. Your writeup, notes.txt, should include all of the commands that you used to create the sound, and describe the sources that you used for each of the sound clips. In order to actually save the sound that you've created to a file, try calling the write() method from within DrJava. That is, if you've named your Sound object mySound, and you wanted to save it to the file mySound.wav, then you'd call mySound.write("mySound.wav"); within the DrJava interactions pane. Submitting Submit your Sound.java and notes.txt files using Eclipse. See the Ambient submit instructions. You should submit under class cps001, assignment name lab09.