Fork me on GitHub

Introduction

MFSampledSP is a free, better-than-nothing, Windows-7-or-later implementation of some of the javax.sound.sampled.spi interfaces. It is part of the SampledSP collection of javax.sound.sampled libraries. Its main purpose is to decode audio from various formats at high speed. Examples for supported formats are MP3 or AAC. That said, MFSampledSP supports all formats also supported by https://msdn.microsoft.com/en-us/library/windows/desktop/dd757927(v=vs.85).aspx.

Note that unlike other providers, MFSampledSP always converts audio data on-the-fly into LPCM. No other conversions are supported. This also means that AudioFormat objects should be interpreted with a grain of salt.

Because MFSampledSP depends on native code, you need to add the provided DLLs to your java.library.path and the provided jar to your classpath. Everything else is taken care of automatically.

Getting Started

The easiest way to use MFSampledSP (other than simply using the jar and 64bit-dll/ 32bit-dll) is to start a Maven project and introduce a MFSampledSP dependency.

To do so, add something like this to the dependencies section of your pom:

<dependency>
    <groupId>com.tagtraum</groupId>
    <artifactId>mfsampledsp</artifactId>
    <version>0.9.7</version>
    <type>jar</type>
</dependency>
<dependency>
    <groupId>com.tagtraum</groupId>
    <artifactId>mfsampledsp</artifactId>
    <version>0.9.7</version>
    <type>dll</type>
    <!-- 32 bit dll -->
    <classifier>i386</classifier>
</dependency>
<dependency>
    <groupId>com.tagtraum</groupId>
    <artifactId>mfsampledsp</artifactId>
    <version>0.9.7</version>
    <type>dll</type>
    <!-- 64 bit dll -->
    <classifier>x86_64</classifier>
</dependency>

If Maven can't resolve this dependency, you might also want to add the following repository to the repositories section of your pom:

<repository>
    <id>beatunes</id>
    <name>beaTunes Repository</name>
    <url>https://www.beatunes.com/repo/maven2</url>
</repository>

As long as the native library is in the same directory as the MFSampledSP jar, it will be picked up.

To use the library, simply use the javax.sound.sampled classes like you normally would.

Requirements

MFSampledSP requires Windows 7 or later.

For a service provider implementation for OS X, based on Apple's CoreAudio, check out CASampledSP.

For a cross platform service provider implementation featuring free formats like FLAC and OGG, take a look at FFSampledSP.

For a cross platform (OS X/Windows) 32 bit service provider based on QuickTime, check out QTSampledSP.