(SOLVED!) Here's what I found out. My construction of the AudioRecord
object was like this:
new AudioRecord(MediaRecorder.AudioSource.MIC,
22050,AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, myBufSize);
where myBufSize was set to a very large 16384. And this caused the
repetition of data every 8192 samples. But when I changed myBufSize to
1792 (the value returned by AudioRecord.getMinBufferSize), then all the
duplication ceased, and every sample was delivered once, and all is well.
I am reading data at 1024 samples per read.
I still don't know why data duplication happens for very large settings of
myBufSize in the constructor, but it does. Tomorrow I will investigate
intermediate values of myBufSize to see at what point the problem begins.
On Friday, October 10, 2014 9:45:32 PM UTC-6, RLScott wrote:
>
> In my musical instrument tuner app I stream audio data to my analysis code
> with an AudioRecord.read() method which runs in a separate thread to
> decouple it from the UI. The AudioRecord was set up with a sample rate of
> 22050 and a 16384 samples. I read the data in chunks of 1024 samples at a
> time. This all works perfectly on every Android device I have checked -
> except for the Moto G. On that device I have been able to verify that the
> data is being corrupted by AudioRecord.read() returning some data that was
> returned earlier. 8192 samples earlier, to be exact. This causes a phase
> jump in the audio data, and therefore an unstable tuning indication. The
> data is being read into a direct buffer.
>
> Does anyone know why the Moto G is doing this?
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.