// the given format.
public static AudioReader getAudioReader(String filename,
AudioFormat decodedFormat) throws IOException,
UnsupportedAudioFileException
{
AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(new File(
filename));
if (fileFormat.getType() != AudioFileFormat.Type.WAVE)
return new CachedAudioReader(filename, decodedFormat);
else
return new WaveAudioReader(filename, decodedFormat);
}