Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Can Java trim MP3 files?

Thread view: 
totoromacau@gmail.com - 18 Jul 2006 10:43 GMT
I am not skillful in Java.  I wish to create an MP3 player as well
include a function that can trim an MP3 file according to the time I
specify, e.g. cut the MP3 starting from 02:15:43.  Does anyone know how
or can you give me some reference or sample?

Thanks.
Oliver Wong - 18 Jul 2006 17:09 GMT
[replying to the subject line]

   Yes, it's possible to write a program which trims mp3 files in Java. It
might not be easy however.

>I am not skillful in Java.  I wish to create an MP3 player as well
> include a function that can trim an MP3 file according to the time I
> specify, e.g. cut the MP3 starting from 02:15:43.  Does anyone know how
> or can you give me some reference or sample?

   Are you skillful at programming in general? You'd have to learn the mp3
file format, and do the appropriate manipulations. You can read some
documentation at http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html it
sounds like it's way above your head, you might want to start on an easier
project before tackling this one.

   - Oliver
Greg Miller - 19 Jul 2006 04:56 GMT
>I am not skillful in Java.  I wish to create an MP3 player as well
>include a function that can trim an MP3 file according to the time I
>specify, e.g. cut the MP3 starting from 02:15:43.  Does anyone know how
>or can you give me some reference or sample?

    I don't believe there are any native (free) libraries to do it
from Java, but you could build a wrapper around LAME:
http://lame.sourceforge.net/
jmcgill - 19 Jul 2006 05:54 GMT
>> I am not skillful in Java.  I wish to create an MP3 player as well
>> include a function that can trim an MP3 file according to the time I
[quoted text clipped - 4 lines]
> from Java, but you could build a wrapper around LAME:
> http://lame.sourceforge.net/

Be aware that MP3 can only be edited in blocks, and cuts are not
possible with much precision.  The best you can do is a single "frame",
144 * BitRate / (SampleRate + Padding).

To do what you want to do, you'll have to first analyze the encoding,
and then figure out in frames where you want to decode.  It is really
the same problem as implementing fast-forward/rewind in a player.

Here's an implementation of mpeg decoding.

http://www.mp3-tech.org/programmer/sources/JavaLayer0.0.8.tar.gz
totoromacau@gmail.com - 20 Jul 2006 04:14 GMT
Thanks all for your information!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.