Ejemplo n.º 1
0
 @Test
 // 用于验证快速傅里叶变换算法的正确性
 public void fftTest() {
   List<Short> audioData1 = new ArrayList<Short>();
   for (short i = 1; i < 9; i++) {
     audioData1.add(i);
   }
   System.out.println(audioData1);
   List<Complex> result = fftTool.fft(audioData1);
   System.out.println("fft以后:");
   System.out.println(result);
   List<Short> result2 = fftTool.ifft(result);
   System.out.println("ifft以后:");
   System.out.println(result2);
 }
Ejemplo n.º 2
0
 @Test
 public void performanceTest() {
   for (int m = 1; m < 15; m++) {
     Date date1 = new Date();
     List<Short> audioData1 = new ArrayList<Short>();
     for (short i = 0; i < Math.pow(2, m); i++) {
       audioData1.add(i);
     }
     List<Complex> result = fftTool.fft(audioData1);
     System.out.println(result.size());
     System.out.println("m=" + m);
     Date date2 = new Date();
     System.out.println(date1);
     System.out.println(date2);
   }
 }