4
실제로 자바 라이브러리를 주로 사용하고 있습니다 만 스칼라에서 mp3를 연결하려고합니다. 및 서면 다음 : 지금까지 내 CLASSPATH에 필요한 물건을 넣었습니다 (MP3 파일을 읽는 방법에 대한 자세한 내용은 http://www.javazoom.net/mp3spi/documents.html 여기 참조)스칼라/자바에서 MP3를 연결하십시오.
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())
}
}
}
하지만 지금에 MP3 파일을 작성 사투를 벌인거야 디스크. 누구든지 나를 도울 수 있습니까? 어떻게 이뤄지나요?
public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
File out) throws IOException
당신은 같은 것을 할 수 있어야한다 :
실제로 MP3 파일을 연결할 수 있습니다. ID3/메타 데이터의 일부는 해제되지만 많은 응용 프로그램에서 문제가되지는 않습니다. –