Re: I dream of converting this file to a real mp3

"Wesley J. Landaker" <[email protected]> Tue, 28 Oct 2008 20:43:59 -0600
Newsgroups gmane.org.user-groups.nmlug
Organization icecavern.net
Message-ID <[email protected]>
On Tuesday 28 October 2008 18:33:12 Kelly Jones wrote:
> Is the sync word always 4 'ff' (decimal 255) in a row?

I'm sorry, I led you astray; the sync word is actually three *nibbles* of f, 
not 4 bytes of ff. (I was apparently thinking of the sync word for a 
different format--I know about WAY too many file formats...) The fourth 
nibble in the 16-bit sync word is info about the version, layer, and error 
correction. So you are actually looking for ff fa (MPEG-1 Layer 3 ECC) or 
ff fb (MPEG-1 Layer 3 no ECC). 

> % \od -x jeannie1.wav | fgrep ffff

Careful: od is showing these as shorts, but is byte swapping them for 
display. So faff and fbff are what we actually want in this display format. 
Note that because word alignment is not required (AFAIR) this could show up 
as ffxx xxfa or ffxx xxfb as well. Try "od -t x1" for an actual view of the 
bytes in order.

> 0000440 9d09 364d ffff e8ff 6a32 3067 ed65 bf4d
> 0000460 ffff faff ca0c 0634 d830 3064 3f03 f8ff
               ^^^^
So this looks like a MP3 frame header sync word. Despite the display order 
from od, the actual byte there stream is ff fa. There will be a sync word 
for every frame in the file, but of course you only really care about 
aligning with the first one.

-- 
Wesley J. Landaker <[email protected]> <xmpp:[email protected]>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

_______________________________________________
NMLUG mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/nmlug
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkkHzfAACgkQ8KmKTEzW49L8GgCcDcAhaOPw/j8ua7Ql6/pY6uOC
mPgAn05EFaUXUM3i/noqLoPwa36U0Unj
=GjNL
-----END PGP SIGNATURE-----