It would depend on the sampling rate of the particular mp3 (e.g. a
256khz MP3 could be *very* roughly 2 times bigger than a 128khz).
MP3's are obviously also compressed. Violin music would contain more
seconds of play in the first 20k bytes than modern rock (signal to noise
ratio ;)
Cheers,
Ben
jeff wrote:
Thanks for the reply Michael.
That is what I have done at the moment, but the issue I have is that
some songs would then play for 1 second, some for 10 seconds. All
depends on the song I suppose.
Maybe I did it incorrectly, I just took the first 20 000 bytes for
example from the byte[]. Would it make a difference if I only read 20
000 bytes from the stream?
Cheers
Jeff
Michael Wiles wrote:
If it's only mp3's you're looking for then a quick and dirty approach is
to just retrieve X bytes of the mp3. mp3's are streamed so if you
truncate them you can still play them, they're just shorter. You'd have
to experiment to see how many bytes would give you about 5 seconds.
You could probably take a similar approach with a lot of sound files,
Waves for instance.
-----Original Message-----
From: jeff [mailto:[EMAIL PROTECTED] Sent: 19 January 2006 03:45 PM
To: [email protected]
Subject: [CTJUG Forum] MP3 / Audio Truncation
Hi All
I need to get the first 5 seconds of an MP3 or any sound file for
that matter.
My MP3's are stored as byte[] in a database. Having looked at a
number of different java API's (well only sound and JMF really) and
not having
any experience with any java media coding, I am hoping someone can point
me in the right direction.....even some code sample :) would be nice.
Thanks in advance
Jeff
--
Ben van der Merwe
[EMAIL PROTECTED]