This is the part of the code which getting only few last seconds of PCM byte array which is recorded by AudioRecorder class:
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.
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);
}
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.