next up previous
Next: 2.2 Java $BMQ$N(B FFT Up: 2.1 WAVE $B%U%!%$%k$rFI$`(B Previous: 2.1 WAVE $B%U%!%$%k$rFI$`(B

2.1.1 ReadWave.java


   1 //
   2 // ReadWave.java
   3 //   2008/1/30 $B=i$a$F:n@.(B
   4 //   2008/2/13 $B0lLZ7/$K%P%0$r;XE&$5$l$k!#(BByte $B$OId9fIU$-$@$C$?!#(B
   5 //
   6 
   7 import java.io.File;
   8 import javax.sound.sampled.*;
   9 
  10 public class ReadWave {
  11   private static final int EXTERNAL_BUFFER_SIZE = 128000;
  12   public static void main(String[] args) {
  13     int frameSize;       //
  14     int sampleSizeInBits; // $B2;@<%G!<%?$N?tCM$N%S%C%H?t(B (16$B$^$?$O(B8)
  15     int channels;        // $B%A%c%s%M%k$N?t(B (2$B$,%9%F%l%*(B, 1$B$,%b%N%i%k(B)
  16     float sampleRate;    // $B%5%s%W%j%s%0%l!<%H(B (1$BIC4V$N(B...)
  17     boolean isStereo;    // $B%9%F%l%*$+(B
  18     boolean isBigEndian; // $B%S%C%0%(%s%G%#%"%s$+(B ($B>e0L%P%$%H$,@h$+(B)
  19     if (args.length == 0) System.exit(0);
  20     try {
  21       // File$B%/%i%9$N%$%s%9%?%s%9$r@8@.$9$k(B
  22       File soundFile = new File(args[0]);
  23       // $B%*!<%G%#%*F~NO%9%H%j!<%`$rpJs%*%V%8%'%/%H$r@8@.$9$k(B
  29       DataLine.Info info = new DataLine.Info(SourceDataLine.class,audioFormat);
  30       // $B;XDj$5$l$?%G!<%?%i%$%s>pJs$K0lCW$9$k%i%$%s$r


next up previous
Next: 2.2 Java $B%X%`!"%[(B FFT Up: 2.1 WAVE $B!&%f!&!#!&!"!&v&rFI$(B/A> Previous: 2.1 WAVE $B%U%!%$%k$rFI$`(B
Masashi Katsurada
$BJ?@.(B20$BG/(B2$B7n(B15$BF|(B