codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Convert WAV in MP3  satoshi at 10:41 on Friday, March 31, 2006
 

I've a problem.. I should do a program that allow to convert a WAV file in a Mpeg 2 Layer 3 (MP3) file trough Java. I've read on various websites that Java doesn't allow the manipulation of MP3 file natively. Therefore I had to download some external libraries. People say that to allow the manipulation of MP3 files in Java, the library to use is MP3SPI that to work need others libraries: JLayer and Tritonus. Little problem: this library doesn't allow to convert WAV in MP3 but only to play MP3 files. Therefore it doesn't allow the MP3 Encoding.

To allow the MP3 encoding in Java, Tritonus has an ulterior library that, trough the encoder Lame, allow the MP3 encoding. When people download this library (download here), the zip file contains alsa a readme file and an example program called Mp3Encoder.java

After the compilation, this program allow to convert a WAV file in a MP3 file trough the command "java Mp3Encoder <file>.wav". And until here it work perfectly. The problem is that the MP3 converted is a Mpeg 1 Layer 3 while I should have a Mpeg 2 Layer 3!
And it isn't so easy as it seems. It doesn't suffice replace the row

private static final AudioFormat.Encoding MPEG1L3 = Encodings.getEncoding("MPEG1L3");

with

private static final AudioFormat.Encoding MPEG1L3 = Encodings.getEncoding("MPEG2L3");

because the program outputs the error "Unsupported conversion". According to the documentation of Lame it shoulds be possible convert in a Mpeg 2 Layer 3!


Where is the problem?


Thanks in advance, Dario Simonetti








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: While Loops - Help please!
•  Re: Perl - Read and Write output file
•  trying to write dates from perl to Excel
•  5x5 Tic Tac Toe
•  NEED HELP!!!! Password encryption
•  positioning ContentPlaceHolder
•  Arrays - Big Problem
•  problem in grid view
•  Re: IsDate() in JavaScript?


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007