Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ID3 Tag in MP3

5 views
Skip to first unread message

Nils Gruson

unread,
Jun 5, 2001, 2:31:24 PM6/5/01
to
How can I read and write ID3 tag information to a MP3-file?

I tried it as follows:


TID3Rec = packed record
Tag : array[0..2] of Char;
Artist,
CD,
Track : array[0..29] of Char;
end;

procedure TTrack.FillID3TagInformation(MP3File: string; Artist, CD, Track:
TEdit);
var
ID3: TID3Rec;
fMP3: file of Byte;
begin

try
AssignFile(fMP3, MP3File);
Reset(fMP3);
finally
try
Seek(fMP3, FileSize(fMP3) - 128);
BlockRead(fMP3, ID3, SizeOf(ID3));
finally
end;
end;

if ID3.Tag <> 'TAG' then
begin
Artist.Text := 'Wrong or no ID3 tag information';
CD.Text := 'Wrong or no ID3 tag information';
Track.Text := 'Wrong or no ID3 tag information';
end
else
begin
Artist.Text := ID3.Artist;
CD.Text := ID3.CD;
Track.Text := ID3.Track;
end;

end;

Tomas Herrmann

unread,
Jun 5, 2001, 5:42:20 PM6/5/01
to

Nils Gruson <ngr...@planet.nl> schrieb in im Newsbeitrag:
9fj8dt$5hsj9$1...@reader03.wxs.nl...
Hi,
I suggest: try http://delphi.about.com/library/weekly/aa112800a.htm
there´s a pretty good example for the mp3 player with capability of reading
(and storing) the tag-fields.
At the end of the sites there is a link to get the whole thing as ZIP.

Ignatius Fourie

unread,
Jun 6, 2001, 2:23:55 AM6/6/01
to
"Tomas Herrmann" <101.1...@germanynet.de> wrote in message news:<9fjjpm$4mdlk$1...@ID-7081.news.dfncis.de>...

> Nils Gruson <ngr...@planet.nl> schrieb in im Newsbeitrag:
> 9fj8dt$5hsj9$1...@reader03.wxs.nl...
> > How can I read and write ID3 tag information to a MP3-file?
> >


Try the following, I have used it before:

procedure TForm1.Button1Click(Sender: TObject);
var f:file of char;
id3:array [0..127] of char;
begin
if opendialog1.execute then
begin
assignfile(f,opendialog1.filename);
reset(f);
seek(f,FileSize(f)-128);
blockread(f,id3,128);
closefile(f);
if copy(id3, 1, 3) = 'TAG' then
begin
label4.caption:=copy(id3, 4, 30);
label2.caption:=copy(id3, 34, 30);
label6.caption:=copy(id3, 64, 30);
label8.caption:=copy(id3, 98, 30);
label10.caption:=copy(id3, 94, 4);
end;
end;

end;

Ignatius Fourie

0 new messages