将多个音频文件合并为一个文件

时间:2011-08-26 11:32:37

标签: java audio

我想将音频文件合并到一个文件中,然后播放该文件。我尝试了很多种方法......

playedFilesSequenceList是arraylist,其中包含R.raw文件夹中的音频文件。

for(int k=0; k<playedFilesSequenceList.size();k++) {
    InputStream inputStream = getResources().openRawResource(playedFilesSequenceList.get(k));
    try {
        int size = inputStream.available();
        byte []buffer = new byte[size];
        inputStream.read(buffer);
        //File destination = new File(getFilesDir(),"mycopy.wav");
        fos.write(buffer);
    } catch(Exception e) {
        e.printStackTrace();
    }
    //readFile(inputStream,destination);
    try {
        inputStream.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

0 个答案:

没有答案
相关问题