audio - Java ogg vorbis encoding -
i using tritonous package audio encoding in ogg-vorbis. face problem when giving audio format.
unsupported conversion: vorbis 44100.0hz, unknown bits per sample, mono, unknown frame size, pcm_signed 44100.0 hz, 16 bit, mono, 2 bytes/frame, little-endian
this code specifying format
file outputfile = new file(userdir+"//san"+"_"+strfilename + ".spx"); // using pcm 44.1 khz, 16 bit signed,stereo. if(osname.indexof("win") >= 0){ system.out.println("windows"); audioformat = getwindowsaudioformat(); samplerate = 44100.0f; }else { system.out.println("mac"); audioformat = getmacaudioformat(); samplerate = 44100.0f; } audioformat vorbisformat = new audioformat(vorbis, samplerate, audiosystem.not_specified, 1, audiosystem.not_specified, audiosystem.not_specified, false); dataline.info info = new dataline.info(targetdataline.class, audioformat); targetdataline targetdataline = null; audiofileformat.type filetype = null; file audiofile = null; filetype = vorbis; try { targetdataline = (targetdataline) audiosystem.getline(info); targetdataline.open(audioformat); } catch (lineunavailableexception e) { system.out.println("unable recording line"); e.printstacktrace(); system.exit(1); } audioinputstream ais = new audioinputstream(targetdataline); ais = audiosystem.getaudioinputstream(vorbisformat, ais); final recorder recorder = new recorder(targetdataline,ais,filetype,outputfile); int number = 0; system.out.println("recording...");
recorder.start();
Comments
Post a Comment