@@ -0,0 +1,1480 @@
+package VQVAD;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.net.MalformedURLException;%0A%0Aimport javax.sound.sampled.AudioFormat;%0Aimport javax.sound.sampled.AudioInputStream;%0A%0Aimport Utils.Player;%0A%0Aimport Frontend.VQVoiceActivityDetector;%0A%0Apublic class PlaybackTest %7B%0A%0A%09private static AudioInputStream copyAis(AudioInputStream source, AudioFormat format) %7B%0A%09%09boolean run = true;%0A%09%09int i = 0;%0A%09%09int buffer_size = 4000;%0A%09%09byte tempBuffer%5B%5D = new byte%5Bbuffer_size%5D;%0A%09%09ByteArrayOutputStream debugStream = new ByteArrayOutputStream();%0A%0A%09%09while (run) %7B%0A%09%09%09int cnt = -1;%0A%09%09%09try %7B//read data from the audio input stream%0A%09%09%09%09cnt = source.read(tempBuffer, 0, buffer_size);%0A%09%09%09%7D catch (IOException e1) %7B%0A%09%09%09%09// TODO Auto-generated catch block%0A%09%09%09%09e1.printStackTrace();%0A%09%09%09%7D%0A%09%09%09if (cnt %3E 0) %7B//if there is data%0A%09%09%09%09try %7B%0A%09%09%09%09%09debugStream.write(tempBuffer);%0A%09%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09%09// TODO Auto-generated catch block%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%7D else %7B%0A%09%09%09%09run = false;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return new AudioInputStream (new ByteArrayInputStream(debugStream.toByteArray()), format, debugStream.size());%0A%09%7D%0A%0A%09/**%0A%09 * @param args%0A%09 * @throws MalformedURLException%0A%09 */%0A%09public static void main(String%5B%5D args) throws MalformedURLException %7B%0A%0A%09%09VQVoiceActivityDetector vac = new VQVoiceActivityDetector(null, %22foo%22);%0A%0A%09%09AudioInputStream debugAis = copyAis(vac, vac.getFormat());%0A%0A%09%09Player.playStream(debugAis);%0A%0A%0A%09%7D%0A%0A%7D%0A

Test class for playing back VAD stream