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
>
>
>
>   


Reply via email to