I'm experiencing java sound conversion from PCM to U-Law or A-Law but 'ive got a lot of problems. With or without Tritonius, i've got an unsupported conversion error. I'm on JDK 1.5, so maybe there's a problem with this version ?
Here is the stacktrace of the java error :
java.lang.IllegalArgumentException: Unsupported conversion: ULAW 8000.0 Hz, 8 bit, mono, 8 bytes/frame, from PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame,
at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
at fr.ft.dps.utils.TestSoundConverter.testWav2Wav(TestSoundConverter.java:53)
And the simple code i use to do that :
File sourceFile = new File("D:/Projets/Contact EveryOne/Developpements/Contact EveryOne/src-test/fr/ft/dps/utils/Calling.wav");
File targetFile = new File("D:/Projets/Contact EveryOne/Developpements/Contact EveryOne/src-test/fr/ft/dps/utils/Calling2.wav");
AudioInputStream sourceAudioInputStream = AudioSystem.getAudioInputStream(sourceFile);
AudioFormat targetFormat = new AudioFormat(new AudioFormat.Encoding("ULAW"), 8000, 8, 1, 8, 8000, true);
AudioInputStream targetAudioInputStream = AudioSystem.getAudioInputStream(targetFormat, sourceAudioInputStream);
AudioSystem.write(targetAudioInputStream, AudioFileFormat.Type.WAVE, targetFile);