Search code examples
javaaudiomp3

Combine two wave files to create a single smoother wave file in java


I have a requirement of joining two audio waves so that the final output audio wave should have a smoother meeting point. I meant at the joining point lets' say for 10 seconds the first audio should start fading out and the other audio starts picking up.

I have already been able to concatenate the two audio files and produce a single output but the output wave file has a abrupt change at the meeting point.

I am looking forward to some code in java (i.e. the crossfading should happen through java code without playing the files in any audio player And just to mention that I am not targeting the android solution.) or please point me to any helpful link demonstrating how to do the same.


Solution

  • What you're talking about is called crossfading. Corssfade means to slowly bring up the volume of the new song while slowly bringing the volume of the old one down. For a time both can be heard.

    You might want to look at these:

    java sound fade out

    concatenating mp3 files or joining mp3 files using java