if (!(input instanceof AudioFormat))
return null;
AudioFormat format = (AudioFormat) input;
double sampleRate = format.getSampleRate();
String reason = null;
double epsilon = 0.25;
// Check to see if some of these restrictions can be removed
if (!format.getEncoding().equalsIgnoreCase(AudioFormat.GSM))
reason = "Encoding has to be GSM";
else if ( Math.abs(sampleRate - 8000.0) > epsilon )
reason = "Sample rate should be 8000. Cannot handle sample rate " + sampleRate;
else if (format.getFrameSizeInBits() != (33*8))
reason = "framesize should be 33 bytes";
else if (format.getChannels() != 1)
reason = "Number of channels should be 1";
if (reason != null) {
return null;
} else {
inputs[0] = format;
return format;
}