Java File Format Conversion Tool
Sometimes a file is correctly formatted and may not be correctly played in some cases. here we can use a java class to help us convert the file format to a correct one.
File source = new File (filepath); int index = amr. lastIndexOf (". "); wavFile = amr. substring (0, index) + ". wav "; File target = new File (wavFile); AudioAttributes audio = new AudioAttributes (); Encoder encoder = new Encoder (); audio. setCodec ("pcm_u8"); audio. setChannels (new Integer (1); audio. setSamplingRate (new Integer (8000); EncodingAttributes attrs = new EncodingAttributes (); can be used to convert the file bit rate, channel and other file header information audio. setCodec ("pcm_u8"); the following values can be referenced:
Pcm_u8 pcm_s16le pcm_s24le pcm_s32le pcm_alaw
Of course there are other formats mp3 can refer to the http://suflow.iteye.com/blog/1742838