What do you mean you by you can't compile it? On Thu, Apr 21, 2011 at 12:41 AM, zhang chun <zypc...@gmail.com> wrote:
> public class project4aczhang34 > { > > public static void main (String[] args) > { > String fname = FileChooser.pickAFile(); > 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); > > String input; > input = SimpleInput.getString ("Please type the message you want > to encode into the your sound file:"); > System.out.println(input); > > int digit1, digit2, digit3; > int temp; > //int array[ ] = new int[100]; > int array[ ]= new int[input.length()*3]; > > > for (int i=0; i<input.length(); i++) > { > char ch = input.charAt(i); > int asciiNum = (int) ch; > System.out.println ("For Character:" + ch + "int ascii value > is;" + asciiNum); > > digit1=asciiNum % 10; > temp = asciiNum /10; > digit2 = temp %10; > temp = temp /10; > digit3 = temp%10; > System.out.println ("The digits are:" + digit1 + "," + digit2 + > "," +digit3); > > array [i*3+0]=digit1; > array [i*3+1]=digit2; > array [i*3+2]=digit3; > Sound NewSound = codesound(s,array); > NewSound.explore(); > } > > > public static Sound codesound (Sound s, int [ ]) > { > SoundSample sampArr [ ]= s.getSamples(); > SoundSample samp; > > int numberOfSamples = s.getLength(); > > Sound s1= new Sound (numberOfSamples); > SoundSample sampArr1 [ ] = s1.getSamples(); > SoundSample samp1; > > int index; > int sampVal, sampVal1; > > for (index =0; index <sampArr1.length; index ++) > { > samp = sampArr [index]; > samp1 = sampArr1 [index]; > > sampVal = samp.getValue(); > > int digit4; > digit4 = sampVal % 10; > int modAmpValue; > modAmpValue = sampVal - digit4; > > if (sampVal >=0) > sampVal1 = modAmpValue + array[index]; > else > sampVal1 = modAmpValue - array[index]; > > if (sampVal >32767) > sampVal1 =sampVal1-10; > else if (sampVal <-32767) > sampVal1 =sampVal1+10; > else > sampVal1= sampVal1; > samp1.setValue (sampVal1); > return s1; > } > > } > } > } > > -- > To post to this group, send email to > javaprogrammingwithpassion@googlegroups.com > To unsubscribe from this group, send email to > javaprogrammingwithpassion+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en