views:

279

answers:

2
+1  Q: 

Mixing Audio Files

Hi,

I have few audio files:

  • f_1 - length 10 sec
  • f_2 - length 3 sec
  • f_3 - length 1 sec

What I need is to find a way to mix(merge) f2 and f3 at particular section in f_1 (i.e. position which is equal to 6 sec)

I was looking at Audio examples but they don't help me much so any ideas\references\ documentation that might help?

Many Thanks!

+2  A: 

Unfortunately, I don't think there's anything on the device to do file mixdowns. As I see it, you've got two options:

1) Send both files to a server and use ffmpeg or some other free tool to do the mixdowns.

2) If it's something that must stay local to the phone, you could load the audio using the Android SoundPool (http://developer.android.com/reference/android/media/SoundPool.html) and set them to play at the same time. You can find a good tutorial on the subject here: http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html

The sound pool requires you to manage multiple files rather than doing mixdowns and playback of a single file. It would be cool if the soundpool let you grap the output as a IOStream but, alas, the SDK doesn't seem to allow it. Further, it would be nice if the AudioRecorder allowed you to grab a stream from the music layer...but that doesn't look possible either. List of audio inputs: http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

I know this isn't exactly what you're looking for, but hopefully you can get a workaround from some of the links.

haseman
+1  A: 

What about converting it to wave and doing a FFT, muxxing it at the desired range ["by hand"] and doing an iFFT and convert it back to mp3.

Note: This involves some math and you should know at least something about how Fourier Transformation works before actual coding.

Note: I don't know if there are "libs" that allow pleasent access to FFT, seeking and/or muxing.

Please correct me if I got a mindflaw, but I think this should work.

penguinpower