zoukankan      html  css  js  c++  java
  • java两个音频进入巩固期 玩的同时类似的伴奏

    	/**
    	 * 
    	 * @param partsPaths 阵列要合成音频路径
    	 * @param unitedFilePath 输入合并结果数组
    	 */
    	public void uniteWavFile(String[] partsPaths, String unitedFilePath) {
    
    			byte byte1[] = getByte(partsPaths[0]);
    			byte byte2[] = getByte(partsPaths[1]);
    
    			byte[] out = new byte[byte1.length];
    			for (int i = 0; i < byte1.length; i++)
    				out[i] = (byte) ((byte1[i] + byte2[i]) >> 1);
    			
    			try {
    				FileOutputStream fos = new FileOutputStream(new File(unitedFilePath));
    				fos.write(out);
    				fos.close();
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    	}
    
    	private byte[] getByte(String path){
    		File f = new File(path);
    		InputStream in;
    		byte bytes[] = null;
    		try {
    			in = new FileInputStream(f);
    			bytes = new byte[(int) f.length()];
    			in.read(bytes);
    			in.close();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		
    		return bytes;
    	}
    	

    版权声明:本文博客原创文章,博客,未经同意,不得转载。

  • 相关阅读:
    vmware fusion和mac共享目录
    安卓linker源码阅读01
    sublime text 快捷键
    eclipse使用经验汇总
    递归池:
    ubuntu下adb红米
    蛋疼问题汇总you must restart adb and eclipse
    JNI
    ARM寻址
    了解装饰器
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/4614415.html
Copyright © 2011-2022 走看看