java - Opus audio File to Wav conversion -


good morning,

i'm trying convert opus audio file wav file on java.

i've been seeking different solutions different libraries, , i've found possible solution. problem output wav audio file has lot of noise, distortion, , don't know how solve this.

here code:

public void opustowav() {      jopusfile infile = new jopusfile(input_file);     audioformat sourceformat = infile.format;     jopusdecodable decoder; // com.glester.jopus.jopusdecodable     bytebuffer samplebuffer;     wavefilewriter wavwriter; // net.sourceforge.jaad.util.wav.wavefilewriter      byte [] buf;     int bytesread = 0;      try {         decoder = jopusbufferfile.loadfromfile(input_file);         samplebuffer = decoder.getsamplebuffer();         wavwriter = new wavefilewriter(outputfile, 44100, sourceformat.getchannels(), sourceformat.getsamplesizeinbits());          buf = new byte[samplebuffer.capacity()];          while(true) {             bytesread = decoder.read();             if(bytesread <= 0) break;             samplebuffer.get(buf);              // needed reduce sample volume in byte array??              wavwriter.write(buf, 0, bytesread);         }          wavwriter.close();         decoder.close();         infile.close();     } catch(urisyntaxexception | ioexception e) {         system.out.println("error decoding opus file --> " +  e.getmessage());     } } 

i've tried modify sample volume in output byte array, problem still there.

any idea how solve this?

p.d: have tried concentus library well, no difference.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -