Considering the following :

1) This is a java users group
2) The topic seems to be how to get a 5 second sample of an MP3
3) MP3's being stored in a DB
4) MP3's sampled at a low rate 32kbps or 64kbps...

Sounds like someone is building a realtone download site... :) *wink* *wink*

Or am I just smoking crack?

Cheers,
Renier

jeff wrote:

Thanks that really help. My MP3's are sampled at either 32kps or 64kps

Thanks
Jeff

Michael Wiles wrote:

No difference on the stream or the byte.

The ones that you're only getting back 1 second for, are they encoded at
a different bit rate, because the higher the bit rate the more you're
going to get back.
The rule of thumb that I've always noticed is that it's about 1 Meg a
minute at 128Kb 44Khz stereo. In other words, 16 Kbytes per second.

So 5 seconds should be about 80 000. This may be a little off because
somewhere along the line, 1024 bytes per Kbyte may be being used.

-----Original Message-----
From: jeff [mailto:[EMAIL PROTECTED] Sent: 19 January 2006 04:10 PM
To: [email protected]
Subject: [CTJUG Forum] Re: MP3 / Audio Truncation


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












Paltrack Pty (Ltd) Reg No 2000/002936/07
Directors: P.W. Mountford (Chairman) | A.J. Mouton (Managing) | S.I. Rocher | 
A.J. de Haast | J.G.F. du Plessis

This email and any accompanying attachments may contain confidential and 
proprietary information. This information is private
and protected by law and, accordingly, if you are not the intended recipient, 
you are requested to delete this entire
communication immediately and are notified that any disclosure, copying or 
distribution of or taking any action based on this
information is prohibited.

Emails cannot be guaranteed to be secure or free of errors or viruses. The 
sender does not accept any liability or
responsibility for any interception, corruption, destruction, loss, late 
arrival or incompleteness of or tampering or
interference with any of the information contained in this email or for its incorrect delivery or non-delivery for whatsoever reason or for its effect on any electronic device of the recipient.

If verification of this email or any attachment is required, please request a 
hard copy version.
______________________________________
Queries to: [EMAIL PROTECTED]

Reply via email to