Question

I try to get raw data in PCM format form fm radio source. I do this:

int bufSize = AudioRecord.getMinBufferSize(SAMPLE_RATE_16kHz, AudioFormat.CHANNEL_IN_MONO,
        AudioFormat.ENCODING_PCM_16BIT);

mRecorder = new AudioRecord(AudioSource.FM_RX, SAMPLE_RATE_16kHz, AudioFormat.CHANNEL_IN_MONO,
        AudioFormat.ENCODING_PCM_16BIT, bufSize);

mBuffer = new short[bufSize / 2];

mRecorder.startRecording();

and when I call in a loop:

int ret = mRecorder.read(mBuffer, 0, mBuffer.length);

the value in ret is 0 and buffer is empty. But if I change AudioSource.FM_RX to AudioSource.MIC I can get data form microphone. What I do wrong?

Was it helpful?

Solution

AudioSource.FM_RX might be available via CyanogenMod but not in the standard API (see e.g. this question).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top