How to record an FM audio in android?

陌路散爱 提交于 2019-11-29 15:18:09

问题


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


回答1:


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.




回答2:


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();  


来源:https://stackoverflow.com/questions/5500925/how-to-record-an-fm-audio-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!