java - Converting Byte Array to Double Array -
I have some problems with WAV files in Java. WAV format: PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes / frames, small-endian I have removed WAV data in a byte array with no problem. I'm trying to convert the byte array to a double array, but some couples come with the "NaN" value. Code: ByteBuffer byteBuffer = ByteBuffer.wrap (byteArray); Double [] doubles = new double [byte array.line / 8]; For (int i = 0; i & lt; doubles; tall; i ++) {couple [i] = byte buffer.get double (i * 8); } The fact of being 16/24/32 bit, mono / stereo confuse me. I intend to pass double [] an FFT algorithm and receive audio frequencies. Thanks Try it out: Public stable byte [] toByteArray (double [] doubleArray) {int times = Double.SIZE / byte.SIZE; Byte [] bytes = new byte [double] Long * bar]; For (int i = 0; i & lt; doubleArray.length; i ++) {BitBufer. Vep (Bytes, I * Bar, Times). Inputable (double other [i]); } Return bytes; } Public stable double []