I poked around the internet a bit but had no luck. Does anyone know if one exists?
4 Answers
Use Quicktime API for doing such a thing,
i have solved my problem using this quickTime.jar
you can download this utility from apple.com
.

- 4,770
- 2
- 36
- 77
-
1Ah but the reason I'm looking for an spi is because I already have almost every other media format supported and working in my system through javasound. So adding WMA support would be as easy as dragging and dropping the .jar. I don't really want a full api. Thanks though! – Nico Apr 12 '12 at 15:00
I realize you're looking for a .jar file to just drop in and provide support for .wma files, but this solution was how I got support for .wma files and it wasn't much more complicated than dropping in a new jar. This isn't technically an SPI, but since there seem to be no such thing I thought a simple alternative might be useful to have posted.
From this answer I found my direction. Before you dive in to JAVE and see what it's about, though, I'll provide a length of code so you can see about how much I had to write to get a wma file converted and playing. Everything JAVE does requires you to use an instance of the Encoder class.
try {
EncodingAttributes attr = new EncodingAttributes();
attr.setAudioAttributes(new AudioAttributes()); //default values
attr.setVideoAttributes(new VideoAttributes()); //default values
attr.setFormat("wav"); //this is the target format I am trying to achieve
//b.wma is a file I brought to the project
File wma = new File("Resources\\b.wma");
//target.wav is the created file I'll achieve after the encode, which gets used to make a Clip
File target = new File("Resources\\target.wav");
Encoder encoder = new Encoder();
//this will show you all supported encoding / decoding formats
//String[] list = encoder.getSupportedEncodingFormats();
//String[] list = encoder.getSupportedDecodingFormats()
encoder.encode(wma, target, attr);
AudioInputStream is = AudioSystem.getAudioInputStream(target);
Clip clip = AudioSystem.getClip();
clip.open(is);
clip.setFramePosition(0);
clip.start();
} catch (IllegalArgumentException | EncoderException e) {
e.printStackTrace();
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (LineUnavailableException e) {
e.printStackTrace();
}
If you're on Windows 7 or later, you might want to try MFSampledSP.
If you're adventurous and need to support other platforms than Windows, you could try modifying FFSampledSP and its upstream project.

- 5,085
- 24
- 56