我使用AudioRecorder錄製了音頻。我需要將錄製的文件合併到一個文件中。任何建議。合併pcm音頻文件
getAudioPath() - audiofiles的路徑。 getCombineFile()---組合文件的路徑。我的問題是第一個文件獨自玩耍,而不是整個文件在該目錄中
public void readAudioAsStream()
{
getAudioPath();
File f=null;
FileInputStream ins = null;
ReadSDDatas rds=new ReadSDDatas();
try
{
String comfile=rds.getCombineFile();
//FileOutputStream fos=new FileOutputStream(comfile);
Log.d("combined file",comfile);
File file=new File(comfile);
RandomAccessFile raf = new RandomAccessFile(file, "rw");
Log.d("path size",Integer.toString(audFullPath.size()));
for(int i=0;i<audFullPath.size();i++)
{
String filepath=audFullPath.get(i);
Log.d("Filepath",filepath);
f=new File(audFullPath.get(i));
fileContent = new byte[read];
ins=new FileInputStream(audFullPath.get(i));
int numofbytes=ins.read(fileContent);
System.out.println("Number Of Bytes Read===========>>>"+numofbytes);
raf.seek(file.length());
raf.write(fileContent);
}
}
catch (FileNotFoundException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*String path=audFullPath.get(val);
playAudio(path);*/
playAudio();
/*
for(int i=0;i<audFullPath.size();i++)
{
Log.d("fullpathsize",Integer.toString(audFullPath.size()));
playAudio(audFullPath.get(i));
}*/
}
通過合併你是不是指在一個文件中按順序播放一個文件,還是同時播放? – Geobits 2011-05-28 11:04:42
我想將它們作爲單個文件播放,無需暫停 – Manikandan 2011-05-28 11:19:31