Android合并音频文件
发布日期:2021-06-30 11:22:40 浏览次数:2 分类:技术文章

本文共 667 字,大约阅读时间需要 2 分钟。

/**	 * 需求:将两个amr格式音频文件合并为1个	 * 注意:amr格式的头文件为6个字节的长度	 * @param partsPaths       各部分路径	 * @param unitedFilePath   合并后路径	 */	public void uniteAMRFile(String[] partsPaths, String unitedFilePath) {		try {			File unitedFile = new File(unitedFilePath);			FileOutputStream fos = new FileOutputStream(unitedFile);			RandomAccessFile ra = null;			for (int i = 0; i < partsPaths.length; i++) {				ra = new RandomAccessFile(partsPaths[i], "r");				if (i != 0) {					ra.seek(6);				}				byte[] buffer = new byte[1024 * 8];				int len = 0;				while ((len = ra.read(buffer)) != -1) {					fos.write(buffer, 0, len);				}			}			ra.close();			fos.close();		} catch (Exception e) {		}	}

转载地址:https://it9527.blog.csdn.net/article/details/8542078 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Java反编译工具jadx入门教程
下一篇:JNI入门完整详细示例

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月21日 09时38分40秒