audio - java Converting mp3 to wav 16 bit mono -


i'm struggling alot converting mp3 wav , changing format it's 16 bit. have program downloads mp3 file google translate's text-to-speech mono, 16000hz, 32 bit. thing needs change 32 bit -> 16 bit. have searched alot think i'm bit noob , i'm doing wrong. i'm searching right java article used wrong 1 , couldn't convert it.

java doesn't support mp3 without additional librarys. list of supported formats: jmf 2.1.1 - supported formats

however, convert bitrate between 2 .wav files, can use javax.sound.sampled:

import javax.sound.sampled.*;  public void changebitrate(file source,file output){   audioformat format=new audioformat(44100,16,1,true,true);   audioinputstream in=audiosystem.getaudioinputstream(source);   audioinputstream convert=audiosystem.getaudioinputstream(format,in);   audiosystem.write(convert,audiofileformat.type.wave,output); }