I am trying to combine mp3s in Scala, although I actually use mostly Java libraries. So far I have put the necessary things on my CLASSPATH (see here: http://www.javazoom.net/mp3spi/documents.html to learn how to read mp3) and the following is written:
import java.io._; import java.io.IOException; import java.io.SequenceInputStream; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; object Main { def main(args: Array[String]) { val fileA = "Track 0000.mp3" val fileB = "Track 0001.mp3" try { var ClipA = AudioSystem.getAudioInputStream(new File(fileA)) var ClipB = AudioSystem.getAudioInputStream(new File(fileB)) var appendedFiles = new AudioInputStream( new SequenceInputStream(ClipA, ClipB), ClipA.getFormat(), ClipA.getFrameLength() + ClipB.getFrameLength()); } catch { case ioe: IOException => println(ioe.getMessage()) case e: Exception => println(e.getMessage()) } } }
But now I'm struggling to burn mp3 to disk. Can someone help me? How it's done?
source share