mercredi 24 décembre 2014

How to decode headphone mic audio signal into digital in android?

i am working over a project where i want to use some external sensors with 3.5m jack so firstly i am tring to get headphone mic signal and convert it into digital. i tring manny things but not able plz help



mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile("/dev/null");



int AUDIO_BUFFER_SIZE = ACQ_AUDIO_BUFFER_SIZE; //44000;//200000;// 16000;
int minBufferSize = AudioTrack.getMinBufferSize(AUDIO_SAMPLE_FREQ, 2, AudioFormat.ENCODING_PCM_16BIT);
if (AUDIO_BUFFER_SIZE < minBufferSize) AUDIO_BUFFER_SIZE = minBufferSize;

Log.i(TAG, "buffer size:" + AUDIO_BUFFER_SIZE);
byte[] audioData = new byte[AUDIO_BUFFER_SIZE];

AudioRecord aR = new AudioRecord(MediaRecorder.AudioSource.MIC,
AUDIO_SAMPLE_FREQ, 2, AudioFormat.ENCODING_PCM_16BIT,
AUDIO_BUFFER_SIZE);

Aucun commentaire:

Enregistrer un commentaire