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;

相关推荐
BIGmustang12 小时前
千帆模型微调及部署
人工智能
神奇霸王龙13 小时前
CC Switch 配置 Claude Desktop+ selltoken 中转 API 实测教程(2026 年 8 月更新)
人工智能·ai·aigc·agent·ai编程·claude
朱涛的自习室13 小时前
从 Prompt 到 Graph:AI 工程的进化史
android·前端·人工智能
程序员cxuan13 小时前
Pi + DeepSeek-v4-Flash,这用着也太爽了。
人工智能·后端·程序员
stormzhangV13 小时前
2026 年 8 月,我的最新 AI 装机单
人工智能·openai·ai编程
暴躁的小鸟13 小时前
附近口碑好的斜视配镜训练的眼视光中心
人工智能·python·深度学习
deepseek2313 小时前
OpenAI 首次为自家模型踩刹车:Astra「无法排除关键网络能力」,Preparedness Framework 第一次真的咬人
人工智能·网络安全·ai agent
zhangfeng113313 小时前
免费 GPU 资源清单(按用途选)包括国产显卡 和 amd显卡 英伟达v100等
人工智能·ai编程·显卡
今天的砖头有点烫手啊14 小时前
AI Agent 开发实战(十):Agent 设计模式(ReAct / Plan-Execute / Reflection)
人工智能·react.js·设计模式
用户81818706274614 小时前
第1章 大模型的本质:为什么"预测下一个词"能做出这么多事
人工智能