Sunday, February 19, 2012

[android-developers] Inserting Recorded Audio file (AMR) in another one

My Android app records audio in both AMR and WAV format. And my
application needs to insert second recorded audio file inside the
first one at a position where it is paused. I did it right with WAV
files, but the AMR file after insertion is not able to be played in
Android MediaPlayer, it gives some error when it reaches the inserted
position.But the same file plays fine in AMR players.

The steps i followed are:

1. Writing the data from file1 upto pause position:

raf3=new RandomAccessFile(result,"rw");
raf3.setLength(0);

int d=0;
//Write data from record1 upto the pause position *
while(d!=pos)
{ raf3.write(bytes[d]); d++; }

2. Writing the data to be inserted from file2

//write all the data from record 2 *
int l=0;
raf3.writeBytes(" ");
while(l!=bytesread1)
{ raf3.write(bytes1[l]); l++; }

3. Writing the remaining data from file1 after pause position

while(d!=size) { raf3.write(bytes[d]); d++; }

Is there anything wrong with what i have done?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment