Hi All,
I am trying to convert .wav file to .mp3 using Mp3Encoder.java given by tritonus.
I have kept tritonus_share.jar, tritonus_mp3.jar,tritonus_remaining-0.3.6.jar files under Jboss...\default\lib & under "ext" folder of Jdk. And lametritonus.dll, lame_enc.dll under Windows\system32. when i run Mp3Encoder.java on the command prompt, the input wave file is converted to .mp3.
Now i am trying to use the same conversion code in an Applet to convert the recorded .wav audioinputstream to .mp3.
below is the code...
import org.tritonus.share.sampled.AudioFileTypes;
import org.tritonus.share.sampled.Encodings;
try {
AudioFileFormat.Type targetType = AudioFileTypes.getType("MP3", "mp3");
String outFilename = "Converted" + "." + targetType.getExtension();
try {
if (AudioSystem.write(getConvertedStream(audioInputStream, Encodings.getEncoding("MPEG1L3")), targetType, new File(outFilename)) == -1) {
throw new IOException("Problems writing to file");
}
} catch (Exception ex) {
reportStatus(ex.toString());
}
}
} catch (Throwable t) {
reportStatus("Exception while converting :"+t.getMessage());
}
}//end try-catch
Here when i record the voice and try to call the above code in a method my program throwing exception as "Exception while converting : org.tritonus.share.sampled.AudioFileTypes".
I also found the exception generating by "AudioFileTypes.getType("MP3", "mp3") " call to the tritonus plugin.
Could you please tell me how to solve this problem.
Thank you,
Kanakam
I am trying to convert .wav file to .mp3 using Mp3Encoder.java given by tritonus.
I have kept tritonus_share.jar, tritonus_mp3.jar,tritonus_remaining-0.3.6.jar files under Jboss...\default\lib & under "ext" folder of Jdk. And lametritonus.dll, lame_enc.dll under Windows\system32. when i run Mp3Encoder.java on the command prompt, the input wave file is converted to .mp3.
Now i am trying to use the same conversion code in an Applet to convert the recorded .wav audioinputstream to .mp3.
below is the code...
import org.tritonus.share.sampled.AudioFileTypes;
import org.tritonus.share.sampled.Encodings;
try {
AudioFileFormat.Type targetType = AudioFileTypes.getType("MP3", "mp3");
String outFilename = "Converted" + "." + targetType.getExtension();
try {
if (AudioSystem.write(getConvertedStream(audioInputStream, Encodings.getEncoding("MPEG1L3")), targetType, new File(outFilename)) == -1) {
throw new IOException("Problems writing to file");
}
} catch (Exception ex) {
reportStatus(ex.toString());
}
}
} catch (Throwable t) {
reportStatus("Exception while converting :"+t.getMessage());
}
}//end try-catch
Here when i record the voice and try to call the above code in a method my program throwing exception as "Exception while converting : org.tritonus.share.sampled.AudioFileTypes".
I also found the exception generating by "AudioFileTypes.getType("MP3", "mp3") " call to the tritonus plugin.
Could you please tell me how to solve this problem.
Thank you,
Kanakam