1. Are you ready for the Galaxy S20? Here is everything we know so far!

Getting white noise when splitting PCM byte array

Discussion in 'Android Development' started by Xempy, Aug 22, 2019.

  1. Xempy

    Xempy Lurker
    Thread Starter

    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.
     


Loading...

Share This Page

Loading...