Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid AudioRecord questions?
    primarykey
    data
    text
    <p>I have been messing around with the AudioRecord feature of the Android API and found some strange behaviors with it. </p> <p>Background info: My phone is a HTC Incredible I am using the Eclipse plugin for Android development with the emulator. Targeted platform or OS is 2.2... Since it is what my phone uses.</p> <p>Some code:</p> <pre><code>bufferSize = AudioRecord.getMinBufferSize(FREQUENCY, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, FREQUENCY, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); </code></pre> <p>This is the code I use to setup the AudioRecord API with. Now, for the emulator it likes FREQUENCY to be set to 8000 for it to work. Comes back with a buffer size 640. For the phone I use 44100. One issue here is it seems the resulting PCM data for the wave seems to be an eight bit signed wave. I get values from -127 to 128. I thought the value <code>AudioFormat.ENCODING_PCM_16BIT</code> would produce something different.</p> <p>I process the audio with a thread,</p> <pre><code>public void run() { while(isRecording) { audioRecord.startRecording(); byte[] data = new byte[bufferSize]; audioRecord.read(data, 0, bufferSize); listener.setData(data); handleData(data); } audioRecord.release(); } </code></pre> <p>I have a way to graphically display to corresponding wave in real time using a <code>SurfaceView</code>. There seems to be a lot of noise coming from the MIC. I get this noise from the emulator and the phone as well. Do I need to run the data through some sort of filter(s)? I would like to use this data to calculate some fun FFT and stuff just to play around with the wave. But I need to reduce the noise somehow. </p> <p>Has anyone else experience this as well. Does anyone have a solution?</p> <p>I appreciated your time and responses, thanks, dk</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload