First off, thank you for you attention and your help! I´ve been trying to create a simple application to learn how android handles audio streams for computer music and digital audio processing applications. Before I start coding I´ve read a lot of material (threads and tutorials) about AudioRecorder so I could find my way but unfortunately I´m facing a problem that neither google search can find recurrencies. Believe it or not! hehehe
Here is the deal ... When my application tries to create a new object from AudioRecorder I get 3 error messages (Logcat): 03-07 02:58:43.048: ERROR/AudioRecord(371): Could not get audio input for record source 1 03-07 02:58:43.048: ERROR/AudioRecord-JNI(371): Error creating AudioRecord instance: initialization check failed. 03-07 02:58:43.109: ERROR/AudioRecord-Java(371): [ android.media.AudioRecord ] Error code -20 when initializing native AudioRecord object. Here is the code I´m using for creating a new AudioRecorder object: //------------------------------------------- package com.examples.audio; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class main extends Activity { /** Called when the activity is first created. */ private TextView tvGravacao; private AudioRecord audioRecord; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tvGravacao = (TextView) findViewById(R.id.tvGravacao); int BUFFER_SIZE = AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, SAMPLE_RATE, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, BUFFER_SIZE); } //------------------------------------------------------- Does anyone have an idea of what could cause this error? My AVD has been set up to handle audio input and output, I have recreated it twice, have tried adding a permission in AndroidManifest.xml but none of them solved my problem. I hope someone has figured this out before. Thanks, Gabriel Simões things I have noticed: sample rate must be 8000 and audioformat must be ENCODING_PCM_16BIT. SR = 44100 or AF = 8 bit crashes app when running AudioRecord.getMinBufferSize(); -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en