I am trying to use `AudioRecord`, but I am unable to initialize recording quite right. I have two devices, on one of them it works well, but the other keeps giving exceptions.

My code:

```
bufferSize = AudioRecord.getMinBufferSize(8000,AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT);
AudioRecord recorder = new AudioRecord(AudioSource.DEFAULT, rate,channelConfig, audioFormat, bufferSize);

```

Why is this wrong and what is the proper way of doing it ?