Getting white noise when splitting PCM byte array

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

This is the part of the code which getting only few last seconds of PCM byte array which is recorded by AudioRecorder class:

ArrayList<Byte> local = new ArrayList<>();
if (readedBytes.size() > RECORDER_SAMPLERATE * 10) {
for (int i = readedBytes.size() - 1 - RECORDER_SAMPLERATE * 10; i < readedBytes.size() - 1; i++) {
local.add(readedBytes.get(i));
}
} else {
local.addAll(readedBytes);
}

byte[] array;
array = new byte[local.size()];

for (int i = 0; i < array.length; i++) {
array = local.get(i);
}

The problem is that, when I have to cut the first part of the array, I'm receiving only the whitenoize.
Important: After this proccess I add the .wav header and this works if the array was not cut.
 
It would be best if you were to join as a member and participate in the developer's sections that we have. Your post can be moved there but in order to reply to a thread, or even participate in any section other than the Ask A Question section you will need to be a registered member. See this link for instructions on how to join Android Central.
 
I moved this to the Software Development forum for more specific traffic.
 

Trending Posts

Forum statistics

Threads
956,347
Messages
6,967,699
Members
3,163,516
Latest member
KidColoringPage