public void run(){
			msg.setText("Tuning...");
			try {
			 final AudioFormat format = presetFormat();
			 DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
			 line = (TargetDataLine) AudioSystem.getLine(info);
			 line.open(format);
			 line.start();
			 int bufferSize = (int) format.getSampleRate()*format.getFrameSize();
			 buffer = new byte[bufferSize];
		
			 while(!stopRequested) {

			 line.read(buffer, 0, buffer.length);

				//System.out.println(Arrays.toString(buffer));
				/* Now FFT
					Declare an FFT
					Find amp of pitch
					If pitch isn't strong, need to tune
					Find which way to tune
					Display Up/Down/Done

				*/

				//Convert bytes to double
			 ByteArrayInputStream bas = new ByteArrayInputStream(buffer);
			 DataInputStream ds = new DataInputStream(bas);
			 double[] dArr = new double[buffer.length / 8];  // 8 bytes per double
			 for (int i = 0; i < dArr.length; i++) {
	     		try {
    	   		dArr[i] = ds.readDouble();
				    } catch (IOException e) {System.err.println("Unable to readDouble");}
				}
        
        int powerOfTwo = (int) Math.pow(dArr.length, 32 - Integer.numberOfLeadingZeros(dArr.length - 1));

        Complex[] data = new Complex[1024];
        int counter = 0;

        for(double temp : dArr) {
          data[counter] = new Complex(temp, 0);
          counter++;
        }
		

		for(counter = 0; counter < 1024; counter++) {
		  if(data[counter] == null)
			data[counter] = new Complex(0,0);
		}

        Complex[] transform = FFT.fft(data);
        counter = 0;
        double[] answer = new double[transform.length];
        for(Complex temp : transform) {
		  //if(temp.im() != 0)
          answer[counter] = temp.im();
        }
		
		FFT.show(transform, "Transformed:");
		
		//msg.setText(answer[]);

		  	}
	   	} catch(LineUnavailableException e) {
			System.err.println("Line Unavailable: " + e);
			System.exit(-1);
		}
	}