@Test public void listen() { SineString ss440 = new SineString(440.0); ss440.pluck(); for (int i = 0; i < 40000; i++) { StdAudio.play(ss440.sample()); ss440.tic(); } }
@Test public void pluckTest() { SineString ss440 = new SineString(440.0); assertEquals(0.0, ss440.sample(), 0.0001); ss440.pluck(); double sample1 = ss440.sample(); ss440.tic(); double sample2 = ss440.sample(); ss440.tic(); double sample3 = ss440.sample(); assertFalse(Math.abs(sample1 - sample2) < 0.000001); assertFalse(Math.abs(sample1 - sample3) < 0.000001); assertFalse(Math.abs(sample2 - sample3) < 0.000001); }