Recording with AudioRecord on Android speeds up the audio?

廉价感情. 提交于 2019-12-03 08:32:07

The audio skipping was caused by the delay in writing to buffer. the solution is to just replace this FOR loop:

        for (int i = 0; i < iBufferReadResult; i++)
        {
            try
            {
                bos.write(buffer[i]);
            } catch (IOException e)
            {                                               
                e.printStackTrace();
            }
        }

by a single write, like so:

       bos.write(buffer, 0, iBufferReadResult);

I had used the code from a book which worked, I guess, for lower sample rates and buffer updates.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!