We help IT Professionals succeed at work.

ID3v2.3 ID32.4 tags

CrazyOne
CrazyOne asked
on
Medium Priority
465 Views
Last Modified: 2013-12-03
Ok I downloaded and used the following

http://www.torry.net/vcl/mmedia/audio/id3v2.zip

and sometimes it works and sometimes it just passes strings like ÿþA. However some freeware tag readers I am using do show the text like the Title, Artist etc. on the same files that the above afore mentioned code shows the ÿþA. I haven't been able to find Delphi code that reads the files appropriately. Also the afore mention code in the zip file doesn't seem to show the Album Artist or Images or things like Track # of Tracks or Disc # of Discs.
Comment
Watch Question

Commented:
Hi,

The problem is that your component can't handle unicode. ÿþ (or FF FE) is the unicode startmarker and the text ends after A since there is a null in the second byte in unicode with normal ascii characters.


/peter

Author

Commented:
How do I rectify that?

Commented:
Since the component can't handle it I'm afraid you have to find another component. This is a very simple component, which only supports the same info as ID3v1. But perhaps you can extend it with the features you're missing? You may find info about the id3 standard at http://www.id3.org/.

I know only of .NET components (have made one myself).


Author

Commented:
Well I am looking for code. I did go to that web site but I don't quite understand what I am suppose to do.

Commented:
You don't find any code there, just the standards so you could write your own code.

Author

Commented:
Yeah I realize that but need help in figuring it out

Commented:
ID3 tags are structured as frames, with a header of ten bytes and then data. There is also one header before the frames. If you decide too extend the component you got, you'll need to add support for the frames with the info you're missing, image and disc#, that is APIC and TPOS. Artist and track# are supported by your component.
What you have to do is add the frame ids 'APIC' and 'TPOS' to the array ID3V2_FRAME, add functions/properties to handle the frames (compare for example the FSetArtist function, and the property Artist).
If you wan't to support unicode, you have to check the first byte of the data in the frames that supports different encodings. Is it 0 then it's the ISO-8859-1 character set, if it's 1 then the text will be in 16 bit unicode with BOM (0xfffe or 0xfeff depening on order). Also you have think about changing the variabletype for the textframe-variables (Artist, Title etc) to byte arrays or convert from unicode before assigning the value, but then you will lose those characters not supported by ISO-8859-1.

By the way the component supports ID3 v2.3 not v2.4.

Author

Commented:
Ok well i just need a little help in getting started if u could show me code on how to read the frame TIT2 [#TIT2 Title/songname/content description] then I can take it from there. I never done unicode before
Commented:
Here's a starter. This will convert unicode to ansi, un-convertable characters will be shown as ?s. If you like to see them, you have to change FTitle to WideString. In delphi 5 at least there's also the problem that the ordinary components like TEditBox wont show unicode.

procedure TID3v2.FSetTitle(const NewTitle: string);
begin
  { Set song title }
  if (NewTitle[1] = #0) then begin
    FTitle := Trim(NewTitle);
  end else if (NewTitle[1] = #1) then begin
    FTitle := Trim(PWideChar(@NewTitle[4]));
  end;
end;

And also in the ReadFromFile function assign the data like

Title := Tag.Frame[1];


I'm not that familiar with unicode and delphi either, and I only have delphi 5 to test on.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I have that code but it doesn't read Unicode

Author

Commented:
Oops soory I didnt mean to post that comment for this Q

I will take your code sample and see what I can do with it
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.