On Fri, Aug 17, 2007, John Joyce wrote:
> That's one point I was definitely concerned about. Some sites  
> describe one or the other, but don't always carefully make the  
> distinction which ID3 version.

Yeah.  MP3s are complex :)

> Well, my script seems to work. For my current purposes it should be  
> enough, but I'm still a little fuzzy on what it means to AND the  
> bytes FFFE and FFFA ?

So you take the first 2 bytes of the file and AND them with FFFE.  If
the result is FFFA, then you've got an mp3 file (albeit one with no
tag).

> What kind of AND?

Bitwise.  Boolean AND doesn't make any sense in this context.

Say the first two bytes are 0xFFFB:

  magic = 0xFFFB
  check = 0xFFFE

  if (magic & check) == 0xFFFA
    puts "you've got an mp3"
  end

> I'm not only trying to have a working script, I want to know what I'm  
> doing here so next time I don't have to ask
> (this is the first time I've delved into binary file structures, so  
> bear with me here.)
> I am learning a lot with this. thanks

No problem.  This stuff is pretty trivial in the grand scheme of things,
but can definitely be confusing if you've never worked with binary
before.

Ben