Well, I was just looking @ my code when you posted this.
I found that I read the channels wrong for stereo (not joint), I use the
channel data to calculate how many samples I need.
I now tried starting @ frame 1 and no problems yet.
So I think it's my mistake, but I can't see why frame 2 always worked for me
:S

About the Meta data, that's true, but that is ignored when the correct seek
is used :)

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Juan Pablo
Califano
Verzonden: woensdag 23 april 2008 14:40
Aan: Flash Coders List
Onderwerp: Re: [Flashcoders] Determining sound sample rate?

Bernard, are you sure the sample rate is sometimes wrong in the first frame
or you mean just the bitrate? I've put some code together to read the tags
and I always seem to get the right value for the sample rate (even for
Xing-encoded mp3's -- assuming those are the ones with a "Xing" string
within the first frame).

In most cases, it's true that the bitrate in the first frame doesn't match
the bitrate you can read if you hover the file name in Windows Explorer (in
Windows, of course), but that's most likely due to variable bitrates. (By
the way, I'm curious about how the explorer -- or any other software --
determines that "average" bitrate; is it really an average of all frames, is
just the bitrate of a fixed frame... does anyone have any clue?)

Anyway, it seems in some cases, the first frame stores some kind of metadata
(I've seen the string "LAME3.92" within the first frame of a Xing-encoded
file, for instance), so it's probably a good idea to go for the second
frame.

Cheers
Juan Pablo Califano

2008/4/23, Bernard Visscher <[EMAIL PROTECTED]>:
>
> I would go for the second frame.
> I've done some testing with loading MP3's in bytearrays then creating a
> SWF
> in a bytearray with the mp3 data.
> When I use the info from frame 1, 50% of the mp3's play with a wrong
> samplerate/bitrate. I think this is done by the Xing encoder.
> When I skip frame 1, all is ok.
>
> Greetz,
>
> Bernard
>
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens ben gomez
> farrell
> Verzonden: woensdag 23 april 2008 3:42
> Aan: Flash Coders List
> Onderwerp: Re: [Flashcoders] Determining sound sample rate?
>
> Thanks!  That should get me on my way.  This, in combination with the
> last reply about getting raw ID3, should help me out.
> So thanks to both of ya.
> ben
>
> Juan Pablo Califano wrote:
> > Hi, as far as I know, the info you're looking for is not in the ID3 tags
> > (which are not mandatory by the way).
> >
> > An mp3 file is a formed by an arbitrary number of "frames", which carry
> > information about "chunks" of the sound stream; each one contains a
> header
> > and the actual audio data. There's no "global" file header, but if
> you're
> > looking for the sample rate, I think it's fair to assume that the sample
> > rate stored in the header of the first frame is the sample rate of the
> whole
> > file (that might not be true if you were looking for, say, the bitrate).
> >
> > So, I think you can get that data if you read the file directly in
> binary
> > format, look for the first frame, and read the bits indicating the
> sample
> > rate.
> >
> > A good reference for the format spec:
> > http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
> >
> > And this graphic may help to "visualize" the meaning of each bit in a
> frame
> > header:
> > http://upload.wikimedia.org/wikipedia/commons/0/01/Mp3filestructure.svg
> >
> > By the way, if you want to inspect the raw file, you should use an
> > hexadecimal editor, you won't get far with a text editor. There are many
> > available, some of them are free, like Hexplorer, which is what I've
> been
> > using for a while.
> > ( you can find it here: http://artemis.wszib.edu.pl/~mdudek/ )
> >
> > I don't know much about the mp3 format specifically, but I have worked a
> bit
> > with raw files, so if you want to give it a try and need some help,
> maybe
> I
> > can lend you a hand.
> >
> >
> > Cheers
> > Juan Pablo Califano
> >
> >
> > 2008/4/21, Steven Sacks <[EMAIL PROTECTED]>:
> >
> >> Ben has an open source project on Google code that is the evolution of
> his
> >> old classes called Metaphile.
> >>
> >> http://code.google.com/p/metaphile/
> >>
> >> _______________________________________________
> >> Flashcoders mailing list
> >> Flashcoders@chattyfig.figleaf.com
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >>
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to