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;

相关推荐
汤姆小白1 小时前
01-环境搭建与项目导览
人工智能·python·机器学习·numpy
喜欢就别3 小时前
【Agentic RL / 强化学习 / OPD】OpenClaw-RL 源码阅读笔记 --- (2)--- On-Policy Distillation
人工智能·笔记
糯米导航6 小时前
AI 视觉回归实战:截图对比不是“找不同”,如何让智能差异分析真正服务 UI 质量
人工智能·ui·回归
科技圈观察6 小时前
2026年好伴AI医疗专用大模型应用梳理与梯队参考
人工智能
jkyy20147 小时前
深耕AI健康医疗数据智库,赋能企业构建主动健康管理新生态
大数据·人工智能·健康医疗
cd_949217217 小时前
3D角色自动绑骨怎么做?用V2Fun完成建模、绑定、动作和导出
人工智能·3d
瑞禧生物tech7 小时前
SH-PEG-Biotin巯基-聚乙二醇-生物素 HS-PEG-Bio 深度解析
人工智能
QYR-分析7 小时前
机器人安全控制器行业高速扩容 本土替代迎来全新发展窗口期
人工智能·安全·机器人
冬奇Lab8 小时前
MCP 系列(06):MCP vs Function Calling——用数据说话的选型指南
人工智能
冬奇Lab8 小时前
每日一个开源项目(第159篇):Vibe-Trading - 用自然语言做量化研究,AI 驱动的个人交易 Agent
人工智能·开源·资讯