Can you please tell me how these lines of code can be modified to be able to play some GSM files.
File audioFile = new File(audioFilePath);
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
AudioFormat format = audioStream.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);
Clip audioClip = (Clip) AudioSystem.getLine(info);
audioClip.open(audioStream);
audioClip.start();
audioClip.close();
audioStream.close();
Thanks
You need to install a java sound service provider for GSM. FFSampledSP would work (via FFmpeg).
Install it and then, to get to a PCM stream, you might need to convert the GSM stream like this:
AudioInputStream gsmStream = AudioSystem.getAudioInputStream(new File("audio.gsm"));
AudioInputStream pcmStream = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, gsmStream);
Limitation: FFSampledSP uses native libraries and is only available for Windows and OS X. Any other platform probably requires quite a bit of work.
Alternatively, you might want to try the GSM 6.10 tritons plugin.