How to record an FM audio in android?

2019-02-07 15:21发布

i need to record the songs being played by a FM app. I checked the MediaRecorder.AudioSource but could not find what to use for setAudioSource

can anyone please help me?

thanks, Ramachandran.R

2条回答
爷、活的狠高调
2楼-- · 2019-02-07 15:56

try this code

    int audioSource = MediaRecorder.AudioSource.VOICE_DOWNLINK;  
    int sampleRateInHz = 8000;  
    int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO;  
    int audioFormat = AudioFormat.ENCODING_PCM_16BIT;  
    bufferSize = AudioRecord.getMinBufferSize(sampleRateInHz,  
            channelConfig, audioFormat);  
    AudioRecord recordInstance = new AudioRecord(audioSource,  
            sampleRateInHz, channelConfig, audioFormat, bufferSize);  
    recordInstance.startRecording();  
查看更多
放荡不羁爱自由
3楼-- · 2019-02-07 16:00

There is no FM radio support in the Android SDK. Various device manufacturers may have hacked in their own FM radio support, but you would have to contact those manufacturers to learn what APIs, if any, they have for them.

查看更多
登录 后发表回答