I am making an android app to record the raw sound data. But after 5 min it stops.
For initializing the buffer to record audio
bufferSize = AudioRecord.getMinBufferSize(rate, channelConfig, audioFormat);
audioBuffer = new short[bufferSize/2];
To read the audio samples to the audiobuffer.
bufferReadSize = audioInput.read(audioBuffer, 0, bufferSize / 2);
Error:
FATAL EXCEPTION: Thread-3601
Process: com.iot.bcrec.soundcapture, PID: 23173
java.lang.ArrayIndexOutOfBoundsException: length=320; index=320
at com.iot.bcrec.soundcapture.SoundService$1.run(SoundService.java:84)
at java.lang.Thread.run(Thread.java:818)
I was thinking to clear my shortbuffer after 320 entries is there any possible method for that?? If you know please help....