[Gambas-user] Music.Length

Stefano Palmeri rospolosco at ...152...
Sat Jun 21 17:22:07 CEST 2008


Il sabato 21 giugno 2008 01:24:51 Lee McPherson ha scritto:
> I've been working on this for mp3 files.  It is really easy to just use
> an external app to get the length of normal bitrate mp3 files as Stefano
> suggested.  For variable bitrate mp3s, it's a little harder.  

Just to say that mp3info, available here

http://ibiblio.org/mp3info/

can even manage VBR mp3 files.

Also, we could use sox:

sox file.mp3 -e stat

but it is much slower than mp3info. 

Ciao a tutti,

Stefano

> There are 
> visual basic scripts on the web that can do this... I have them
> somewhere in my files.  If I can find them, I'll share them.
>
> However, it's not perfect.  From what I remember, it goes through each
> frame of the mp3 and calculates an average length for each frame, to
> give you an approximate time length for the whole mp3.  So seeking in
> that track will not work correctly, but it doesn't work perfectly in any
> player as far as I know.  I never finished coding this into my own app
> though (which plays mp3 files from MySQL somewhat like Amarok does, but
> using VLC player).
>
> -Lee
>
> Benoit Minisini wrote:
> > On vendredi 20 juin 2008, Benoit Minisini wrote:
> >> On vendredi 20 juin 2008, Patrik Karlsson wrote:
> >>> Hello, I'm about to port an old Delphiapp to a nicer environment and
> >>> I'm looking at Gambas to do the work, Gambas is realy nice!
> >>>
> >>> One function I used in Delphi was to get the length of the sound
> >>> played in TMediaPlayer, since I would like things done after 80%,
> >>> 90%...
> >>> Music.Pos tells me where I am, but I can not found a function that
> >>> tells me how far I have to go.
> >>>
> >>> Is there a solution to this?
> >>
> >> Alas, if I remember correctly, the SDL library has no method to know the
> >> length of the music! I don't know if it has changed recently, I will
> >> check...
> >
> > Apparently, SDL cannot extract the audio length from some formats, like
> > MP3 with a variable bitrate stream.
> >
> > I don't know why apparently the length of the audio is not encoded in the
> > file header...
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list