AudioRecord录音和AudioTrack播放

AudioRecord使用

AudioRecord record = new AudioRecord(

MediaRecorder.AudioSource.MIC, sampleRate, channelConfig, audioFormat, bufferSize);

常用

AudioSource.DEFAULT // 默认音频源

AudioSource.MIC // 主麦克风

AudioSource.CAMCORDER // 与摄像头方向一致的麦克风

AudioSource.VOICE_RECOGNITION // 语音识别

AudioSource.VOICE_COMMUNICATION // 语音通话(回声消除等)

AudioSource.UNPROCESSED // 原始未处理的音频(Android 6.0+)

// 语音通话相关(需要特殊权限)

AudioSource.VOICE_UPLINK // 上行语音(发送)

AudioSource.VOICE_DOWNLINK // 下行语音(接收)

AudioSource.VOICE_CALL // 双向语音通话

系统级 AudioSource

AudioSource.VOICE_PERFORMANCE // 高性能语音(低延迟)

AudioSource.REMOTE_SUBMIX // 录制系统音频输出(需要权限)

AudioSource.ECHO_REFERENCE // 回声参考信号

AudioSource.RADIO_TUNER // 调谐器音频输入

AudioSource.HOTWORD // 热词检测

AudioSource.ULTRASOUND // 超声波音频

AudioTrack使用

/** Used to identify the volume of audio streams for notifications /
public static final int STREAM_NOTIFICATION = AudioSystem.STREAM_NOTIFICATION;
/
* @hide Used to identify the volume of audio streams for phone calls when connected

to bluetooth /
public static final int STREAM_BLUETOOTH_SCO = AudioSystem.STREAM_BLUETOOTH_SCO;
/
@hide Used to identify the volume of audio streams for enforced system sounds

in certain countries (e.g camera in Japan) /
public static final int STREAM_SYSTEM_ENFORCED = AudioSystem.STREAM_SYSTEM_ENFORCED;
/
* Used to identify the volume of audio streams for DTMF Tones /
public static final int STREAM_DTMF = AudioSystem.STREAM_DTMF;
/
* @hide Used to identify the volume of audio streams exclusively transmitted through the

speaker (TTS) of the device /
public static final int STREAM_TTS = AudioSystem.STREAM_TTS;
/
* Used to identify the volume of audio streams for accessibility prompts /
public static final int STREAM_ACCESSIBILITY = AudioSystem.STREAM_ACCESSIBILITY;
/
* @hide Used to identify the volume of audio streams for virtual assistant */
public static final int STREAM_ASSISTANT = AudioSystem.STREAM_ASSISTANT;

相关推荐
千匠网络21 小时前
破局出海壁垒,千匠网络新能源汽车跨境出海解决方案
人工智能
马丁聊GEO1 天前
解码AI用户心智,筑牢可信GEO根基——悠易科技深度参与《中国AI用户态度与行为研究报告(2026)》发布会
人工智能·科技
nap-joker1 天前
Fusion - Mamba用于跨模态目标检测
人工智能·目标检测·计算机视觉·fusion-mamba·可见光-红外成像融合·远距离/伪目标问题
一只幸运猫.1 天前
2026Java 后端面试完整版|八股简答 + AI 大模型集成技术(最新趋势)
人工智能·面试·职场和发展
Promise微笑1 天前
2026年国产替代油介损测试仪:油介损全场景解决方案与技术演进
大数据·网络·人工智能
深海鱼在掘金1 天前
深入浅出 LangChain —— 第三章:模型抽象层
人工智能·langchain·agent
生信碱移1 天前
PACells:这个方法可以鉴定疾病/预后相关的重要细胞亚群,作者提供的代码流程可以学习起来了,甚至兼容转录组与 ATAC 两种数据类型!
人工智能·学习·算法·机器学习·数据挖掘·数据分析·r语言
workflower1 天前
具身智能行业应用-生活服务业
大数据·人工智能·机器人·动态规划·生活
GitCode官方1 天前
基于昇腾 MindSpeed LLM 玩转 DeepSeekV4-Flash 模型的预训练复现部署
人工智能·开源·atomgit
大刘讲IT1 天前
AI重塑企业信息价值标准:从“系统供给”到“用户定义”的企业数字化新范式
人工智能·经验分享·ai·制造