0

I need to send text to server, get wav streaming data (Base64 form and locally converting to byteArray), save and play the files. As retrofit cannot process larger than around 5 million characters I am splitting the text into pieces and getting the several wav streaming data. Now my target is to save the fetched multiple wav data into one file and play further.

But the problem is when I am concatenating the stream data(byteArray), the files playing the first one only. I googled and searched in SO for solutions but it is not working at all. what could be the reason(could be for header issue and I tried skipping first 44 length from 2nd one).

this is how tried

        if (count == 0)
            allByteArray += clipData
        else
            allByteArray += clipData.copyOfRange(44,clipData.size)
        count += 1
        return until all arrayByte
        val output = FileOutputStream(file,true)
        output.write(allByteArray)
        output.close()
James Z
  • 12,209
  • 10
  • 24
  • 44
im07
  • 386
  • 2
  • 12
  • Please avoid using words like *lac* that are not globally understood – James Z Oct 24 '22 at 14:43
  • Does this answer your question? [Merging two WAVE files on Android (concatenate)](https://stackoverflow.com/questions/18750892/merging-two-wave-files-on-android-concatenate) – TDG Oct 24 '22 at 16:50
  • @TDG I checked that question before my post. Also checked many other posts. but did not find – im07 Oct 25 '22 at 02:59

1 Answers1

0

I solved the issue. I have just updated the file size in header(sum of all files size replaced to index 40-43)

im07
  • 386
  • 2
  • 12