[Gambas-user] Read in EXEC..... to Rob
Rob
sourceforge-raindog2 at ...94...
Sat Oct 30 06:44:25 CEST 2004
On Friday 29 October 2004 19:54, LB Audio wrote:
> I wanted to use gb.sdl, but doesn't have the total time of the
> audio mp3. I am writing a program in skunks to play mp3
> playlis. I am DJ and programmer in VB the more than 5 years.
> I have a program that I wrote using bass.dll.
Yeah, as I said last week, you won't get a reliable total time of
the mp3 using most common mp3 utilities. mpg321 will give you
running time and an approximation of total time, but it will
change constantly if your mp3 file is variable bitrate.
The sample code I provided will give you running time... total
time is in square brackets following it in mpg321's output, like
so:
Playing MPEG stream from 01 - Yes - Close To The Edge.mp3 ...
MPEG 1.0, Layer: III, Freq: 44100, mode: Joint-Stereo, modext: 2,
BPF : 2560
Channels: 2, copyright: No, original: Yes, CRC: No, emphasis: 0.
Bitrate: 128 Kbits/s, Extension value: 2
Audio: 1:1 conversion, rate: 44100, encoding: signed 16 bit,
channels: 2
Frame# 119 [42859], Time: 00:03.10 [18:39.58],
[0:03] Decoding of 01 - Yes - Close To The Edge.mp3 finished.
You can use every line there (mpg321 also outputs some lines I
didn't include, like the no-warranty notice.) Line 1 tells you
it's successfully playing the file, and the filename. Line 2
tells whether it's MPEG-1 or MPEG-2, Layer II or III (mp3's
should always be III), its original sample rate, what kind of
stereo encoding it has if any, and the bits per frame.
Line 3 tells how many channels are in the file, and the mp3 flags
no one ever uses for copy protection and error correction. Line
4 tells you the bitrate of the first frame... not so useful,
really. Line 5 tells you the output audio format, and finally,
line 6 tells you the frame number, total number of frames, the
time elapsed and the estimate of total time.
You can look for line 7 to determine when mpg321 has exited
safely.
Rob
More information about the User
mailing list