Sup! Trying to merge a list of audio files on top of each other into one audio file. Followed the answer on this question, but it just doesn't work. Also I tried this(the code below) but it doesn't work either(probably because javax is not compatible with Android)
Even if you know how to do this only with the usage of other libraries for Android, please, show it. The only thing that I ask is it should be done locally, without using servers.
Thank you!
public class JoinWavs{
public static void main(String[] args) {
String wavFile1 = "D:\\wav1.wav";
String wavFile2 = "D:\\wav2.wav";
try {
AudioInputStream clip1 = AudioSystem.getAudioInputStream(new File(wavFile1));
AudioInputStream clip2 = AudioSystem.getAudioInputStream(new File(wavFile2));
AudioInputStream appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, clip2),
clip1.getFormat(),
clip1.getFrameLength() + clip2.getFrameLength());
AudioSystem.write(appendedFiles,
AudioFileFormat.Type.WAVE,
new File("D:\\wavAppended.wav"));
} catch (Exception e) {
e.printStackTrace();
}
}
}