Java - converting byte array of audio into integer array -


Let me pass audio data in a 3-party system as "16-bit integer array" (I have limited documents) Will happen .

This is what I have tried so far (the system reads it as a result byte data file).

  AudioInputStream inputStream = AudioSystem.getAudioInputStream (new file ("C: \\ all.wav")); Int numBytes = inputStream.available (); Byte [] buffer = new byte [numBytes]; Inputstream.read (buffer, 0, numbytes); BufferedWriter fileout = new buffed vater (new flamer (new file ("c: \\ temp \\ bytes.dat"))); Bytebuffer BB = BitBuffered.butter (buffer); While (BB) clearance ()> 1) {abbreviated current = BBTat (); FileOut.write (String.valueOf (current)); FileOut.newLine (); }  

It does not appear to be working - the third party system does not recognize it and I can not even import the file as raw audio in Audacity.

Is there anything clear that I am doing wrong or is there a better way of doing this?

Additional information: wave file 16 beats, 44100 HJ, mono.

Edit 2: I rarely use audioInstream, But as you write raw data, it looks complicated too. A file is a bunch of later bytes, so that you can write your audio byte array with a single FileOutputStream.write () call. The system can use large endian format while the WAV file is stored at the very end (?).

Edit 3

The code sample was deleted.

Is there any reason you are writing audio bytes as strings in file with newlines? I would think that the system expects audio data in binary format, not in string format.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -