[Gambas-user] Music.Length
Stefano Palmeri
rospolosco at ...152...
Fri Jun 20 13:25:03 CEST 2008
Il venerdì 20 giugno 2008 13:09:34 Patrik Karlsson ha scritto:
> 2008/6/20 Benoit Minisini <gambas at ...1...>:
> > I don't know why apparently the length of the audio is not encoded in the
> > file header...
>
> Ok, I see, at http://www.mp3-tech.org/programmer/frame_header.html I found
>
> "There is no main file header in an MPEG audio file. An MPEG audio
> file is built up from a succession of smaller parts called frames. A
> frame is a datablock with its own header and audio information.
> In the case of Layer I or Layer II, frames are some totally
> independent items, so you can cut any part of MPEG file and play it
> correctly. The player will then play the music starting to the first
> plain valid frame founded. However, in the case of Layer III, frames
> are not always independant. Due to the possible use of the "byte
> reservoir", wich is a kind of buffer, frames are often dependent of
> each other. In the worst case, 9 frames may be needed before beeing
> able to decode one frame."
If you have "mp3info" installed in your system you can get the length:
SHELL "mp3info -x " & "pathtofile.mp3" & " | grep 'Length:' | awk '{print
$2}'" TO sString
Stefano
More information about the User
mailing list