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;

相关推荐
vivo互联网技术40 分钟前
ICLR2026 | 视频虚化新突破!Any-to-Bokeh 一键生成电影感连贯效果
人工智能·python·深度学习
OpenBayes贝式计算1 小时前
边看、边听、边说,MiniCPM-0-4.5 全双工全模态模型;Pan-Cancer scRNA-Seq 涵盖三种生物学状态单细胞转录数据集
人工智能·深度学习·机器学习
OpenBayes贝式计算1 小时前
教程上新丨基于500万小时语音数据,Qwen3-TTS实现3秒语音克隆及精细调控
人工智能·深度学习·机器学习
CoovallyAIHub1 小时前
开源:YOLO最强对手?D-FINE目标检测与实例分割框架深度解析
人工智能·算法·github
用户2576595759092 小时前
当人类知识学会自己奔跑--skill
人工智能
个入资料4 小时前
阿里云ecs+飞书搭建openclaw
人工智能
孤烟5 小时前
【RAG 实战系列 02】检索精度翻倍!混合检索(稀疏 + 稠密)实战教程
人工智能·llm
明明如月学长5 小时前
OpenClaw 帮我睡后全自动完成了老板交代的任务
人工智能
uuware5 小时前
Lupine.Press + AI 助您分分钟搞定技术项目的文档网站
人工智能·前端框架