Forums Register Login

Applet wav to mp3 conversion - tritonus plugins, lame dlls

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
I suspect it's a permission thing because the code tries to do something that applets aren't allowed to do. Seeing the full chain of exceptions would help.
+Pie Number of slices to send: Send
Hi Ulf,

Here is the stack trace

java.lang.NoClassDefFoundError: org/tritonus/share/sampled/AudioFileTypes
at com.kas.rdd.sound.CapPback.convertTheStream(CapPback.java:768)
at com.kas.rdd.sound.CapPback.actionPerformed(CapPback.java:483)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
throwable rg/tritonus/share/sampled/AudioFileTypes

Thanks.
+Pie Number of slices to send: Send
It seems that the applet JRE doesn't have access to those files you put in the "ext" directory. Maybe you have more than one JRE installed, and the applet plugin uses a different one?
+Pie Number of slices to send: Send
Thanks Ulf,

Just before your reply i found the problem. And what you said is the correct.
I tried putting the jar files in other JRE also. Now my applet is recognizing.

Thank you,
Amos
Evildoers! Eat my justice! And this tiny ad's justice too!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3864 times.
Similar Threads
java sound I/O
MP3 and byte array conversion
audio visualization graphics
Audio format conversion problems
Converting wav file formats Using java Sound API
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:52:33.