Program: 39238
Project: 39238
Buggy source:
/** 
 * Test client - play an A major scale to standard audio.
 * @param args the command-line arguments
 */
public static void main(String[] args){
  double freq1=440.0;
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * Math.sin(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * ActivationFunctions.squareWave(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * ActivationFunctions.triangleWave(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  double[] exampleSound=new double[StdAudio.SAMPLE_RATE + 1];
  double freq2=440.0;
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[i]=(0.5 * Math.sin(2 * Math.PI * freq2* i / StdAudio.SAMPLE_RATE));
  }
  StdAudio.play(exampleSound);
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[i]=(0.5 * ActivationFunctions.fullSawtooth(2 * Math.PI * freq2* i / StdAudio.SAMPLE_RATE));
  }
  StdAudio.play(exampleSound);
  double[] test=new double[500];
  for (int i=0; i < test.length; i++) {
    test[i]=i;
  }
  StdAudio.play(test);
  for (double i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[(int)i]=(ActivationFunctions.tanh(2 * (i / StdAudio.SAMPLE_RATE) - 1));
  }
  StdAudio.play(exampleSound);
  ArrayList<Double> fileArrayList=ArrayUtil.doubleVectorFromArray(exampleSound);
  DrawingPanel panel=new DrawingPanel(500,500,"String_Node_Str");
  Plot.linePlot(panel,-1.0,1.0,fileArrayList,Color.black);
  String pirates="String_Node_Str";
  playApplet(pirates);
  StdAudio.close();
}

Fixed version (ground truth):
/** 
 * Test client - play an A major scale to standard audio.
 * @param args the command-line arguments
 */
public static void main(String[] args){
  double freq1=440.0;
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * Math.sin(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * ActivationFunctions.squareWave(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    StdAudio.play(0.5 * ActivationFunctions.triangleWave(2 * Math.PI * freq1* i / StdAudio.SAMPLE_RATE));
  }
  double[] exampleSound=new double[StdAudio.SAMPLE_RATE + 1];
  double freq2=440.0;
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[i]=(0.5 * Math.sin(2 * Math.PI * freq2* i / StdAudio.SAMPLE_RATE));
  }
  StdAudio.play(exampleSound);
  for (int i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[i]=(0.5 * ActivationFunctions.fullSawtooth(2 * Math.PI * freq2* i / StdAudio.SAMPLE_RATE));
  }
  StdAudio.play(exampleSound);
  double[] test=new double[500];
  for (int i=0; i < test.length; i++) {
    test[i]=i;
  }
  StdAudio.play(test);
  for (double i=0; i <= StdAudio.SAMPLE_RATE; i++) {
    exampleSound[(int)i]=(ActivationFunctions.tanh(2 * (i / StdAudio.SAMPLE_RATE) - 1));
  }
  StdAudio.play(exampleSound);
  ArrayList<Double> fileArrayList=ArrayUtil.doubleVectorFromArray(exampleSound);
  DrawingPanel panel=new DrawingPanel(500,500,"String_Node_Str");
  GraphicsUtil.linePlot(panel,-1.0,1.0,fileArrayList,Color.black);
  String pirates="String_Node_Str";
  playApplet(pirates);
  StdAudio.close();
}