*
The moose likes Applets and the fly likes Applet wav to mp3 conversion - tritonus plugins, lame dlls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet wav to mp3 conversion - tritonus plugins, lame dlls" Watch "Applet wav to mp3 conversion - tritonus plugins, lame dlls" New topic
Author

Applet wav to mp3 conversion - tritonus plugins, lame dlls

Amos Matt
Greenhorn

Joined: Mar 30, 2007
Posts: 17
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
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.


Ping & DNS - my free Android networking tools app
Amos Matt
Greenhorn

Joined: Mar 30, 2007
Posts: 17
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
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?
Amos Matt
Greenhorn

Joined: Mar 30, 2007
Posts: 17
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet wav to mp3 conversion - tritonus plugins, lame dlls