In the WavRecorder, the writeAudioDataToFile thread first write all the recorded PCM data to output file, then reopen this file with RandomAccessFile and go to the head with seek(0) and then write the generated wav header.
In most cases, this would be fine. The beginning 44B of the recording typically contains nothing so important. But if the AudioFormat is not PCM16, like PCM24, the overwritten header will cause mis-interpretation for the following PCM data, as 44 cannot be divided by 6 or 3.
Maybe writting a fake wav header in writeAudioDataToFile is a good idea.
https://github.com/Dimowner/AudioRecorder/blob/325642afa0c9ff9f1b9535eddf38bf43274bf9b3/app/src/main/java/com/dimowner/audiorecorder/audio/recorder/WavRecorder.java#L260C1-L261C1
In the
WavRecorder
, thewriteAudioDataToFile
thread first write all the recorded PCM data to output file, then reopen this file with RandomAccessFile and go to the head withseek(0)
and then write the generated wav header.In most cases, this would be fine. The beginning 44B of the recording typically contains nothing so important. But if the AudioFormat is not PCM16, like PCM24, the overwritten header will cause mis-interpretation for the following PCM data, as 44 cannot be divided by 6 or 3.
Maybe writting a fake wav header in
writeAudioDataToFile
is a good idea.