/** * Class for creating a template for a simple Java program * * @author Pat Troy: troy AT uic DOT edu */ import java.awt.Color; // Note the name of the class in the following line MUST // match the name of the file. public class Lect41b { public static void main (String[] args) { String fname = FileChooser.pickAFile(); //System.out.println (fname); Sound s = new Sound (fname); System.out.println ("Number of samples in the sound: " + s.getLength()); System.out.println ("Number of samples per second: " + s.getSamplingRate()); double lengthInSeconds = s.getLength() / s.getSamplingRate(); System.out.println ("The length in seconds of the sound: " + lengthInSeconds); increaseVolume (s); s.explore(); } public static void increaseVolume (Sound s) { SoundSample sampArr[] = s.getSamples(); int index; int sampVal; System.out.println ("Number of samples in the sound: " + sampArr.length); for ( index = 0 ; index < sampArr.length ; index++ ) { sampVal = sampArr[index].getValue(); sampVal = sampVal * 6; if (sampVal > 32767) sampVal = 32767; if (sampVal < -32768) sampVal = -32768; sampArr[index].setValue(sampVal); } } } // end of class