I need WAV format audio files to establish some functions but if i get AMR format audio files from client side to server, I need convert it into WAV format. Now i am using JAVE library file to convert other format audio media files into WAV format. Everything works fine but when i receive AMR Audio files, it throws Exception like "it.sauronsoftware.jave.EncoderException: Duration: N/A, bitrate: N/A", I have posted my code below...
/**
* method to convert all media format to wav format
*
* @param fileLoc
* @return
*/
public static String universalContentToWav(String fileLoc) {
String location = SoundWaveConstants.AUDIO_LOCATION + new Date().getTime() + ".wav";
AudioAttributes audio = new AudioAttributes();
audio.setCodec("pcm_s16le");
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("wav");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
try {
encoder.encode(new File(fileLoc), new File(location), attrs);
System.out.println("done");
} catch (Exception e) {
e.printStackTrace();
}
return location;
}
I am using the java library file from http://www.sauronsoftware.it/projects/jave/. Is there any way to change AMR file to WAV or need some changes in my code. Thanks in advance.