convert audio tide wav byte array java but temp file


given an inputstream called in contains audio information dense format (such mp3 ogg), i wish emanate byte array containing wav reworking quarrel data. unfortunately, try this, javasound hands following error:



java.io.ioexception: tide length specified


i managed work minute wav surrogate file, following reading behind in, shown below:



audioinputstream source = audiosystem.getaudioinputstream(new bufferedinputstream(in, 1024));
audioinputstream pcm = audiosystem.getaudioinputstream(audioformat.encoding.pcm_signed, source);
audioinputstream ulaw = audiosystem.getaudioinputstream(audioformat.encoding.ulaw, pcm);
file tempfile = file.createtempfile("wav", "tmp");
audiosystem.write(ulaw, audiofileformat.type.wave, tempfile);
// filetobytearray() slight reads file
// byte array; wanting brevity
byte[] bytes = filetobytearray(tempfile);
tempfile.delete();
return bytes;


this apparently reduction desirable. there improved way?



Comments

Popular posts from this blog

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?

grails record upload problems

how i emanate permitted url asp.net mvc?