• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Getting white noise when splitting PCM byte array

Xempy

Lurker
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.
 
Back
Top Bottom