我正在尝试使用Java将mp3文件转换为音频输入流。以下是我的代码部分。
**File file = new File("/root/Desktop/files/Song1.mp3");
AudioFileFormat baseFileFormat = null;
AudioFormat baseFormat = null;
baseFileFormat = AudioSystem.getAudioFileFormat(file);
baseFormat = baseFileFormat.getFormat();
AudioFileFormat.Type type = baseFileFormat.getType();
float frequency = baseFormat.getSampleRate();
System.out.println("Sample Rate: " + baseFormat.getSampleRate());
System.out.println("Frame Size: " + baseFormat.getFrameSize());
System.out.println("Frame Rate: " + baseFormat.getFrameRate());
System.out.println("Sample Size In Bits: " + baseFormat.getSampleSizeInBits());
AudioInputStream in = AudioSystem.getAudioInputStream(file);**
我已经包含以下Jars: jl1.0.1.jar,tritonus_share.jar,mp3spi1.9.5.jar
我收到以下异常:
线程“main”中的异常 javax.sound.sampled.UnsupportedAudioFileException:
file is not a supported file type
。
在此方面提供任何形式的帮助都将受到赞赏。