Help, How do I get the Id3 tags from an MP3. I need like, the artist, song name, and Genre.
please somebody help.
Thanks
~~~~~~~
AGbsa84
Printable View
Help, How do I get the Id3 tags from an MP3. I need like, the artist, song name, and Genre.
please somebody help.
Thanks
~~~~~~~
AGbsa84
If you read the actual MP3 file into your program you'll see the information stored at the end of the file, after the TAG keyword. It's just a matter of parsing the file's data from there.
I'm just working on a related project, so you may have my code:
Code:Sub ID3splitTAG(ID3TAG, ID3Title, ID3Artist, ID3Album, ID3Year, ID3Comment, ID3Genre)
If Left(ID3TAG, 3) = "TAG" Then
ID3Title = RTrim(Mid(ID3TAG, 4, 30))
ID3Artist = RTrim(Mid(ID3TAG, 34, 30))
ID3Album = RTrim(Mid(ID3TAG, 64, 30))
ID3Year = Val(RTrim(Mid(ID3TAG, 94, 4)))
ID3Comment = RTrim(Mid(ID3TAG, 98, 30))
ID3Genre = Val(Asc(Mid(ID3TAG, 128, 1)))
End If
End Sub
Function ID3createTAG(ID3Title, ID3Artist, ID3Album, ID3Year, ID3Comment, ID3Genre)
ID3createTAG = "TAG" & Left(ID3Title & Space(30), 30) & Left(ID3Artist & Space(30), 30) & Left(ID3Album & Space(30), 30) & Left(ID3Year & Space(4), 4) & Left(ID3Comment & Space(30), 30) & Chr(Val(ID3Genre))
End Function
Function ID3getTAG(filename As String) As String
Dim astring As String * 128
ff = FreeFile
Open filename For Binary As ff
Get ff, LOF(ff) - 127, astring
Close ff
ID3getTAG = astring
End Function
Sub ID3setTAG(filename As String, aTAG As String)
Dim astring As String * 128: astring = aTAG
ff = FreeFile
Open filename For Binary As ff
If Left(ID3getTAG(filename), 3) = "TAG" Then
Put ff, LOF(ff) - 127, astring
Else
Put ff, LOF(ff) + 1, astring
End If
Close ff
End Sub
Thanks for the code, but how do I put it into my prog??? I tried but i don't quite understand it.
~~~~~~~
AGbsa84
I have tried you code and it works great, but when trying to access file on a network computer shared as writeprotected the file wont open. You get "Runtime-Error 75 Path/File access error".
Im also working a simular project and ran into that problem too and sadly I havent solved It yet. Do you got any Idea how to solve it?
I am running his code, and I have all my MP3's stored on my UNIX network file server. I have no problem accessing those files. They are not read/write protected (by me anyway), but his code works file w/o errors.
Tom
Hi Kedaman!
Are you working on full featured MP3 player with your own MP3 decoding engine? I am too working on a rack based media player and everything is finished except my own Mp3 engine. I did not find any tutorials or posts on this subject. Hope you can help me in that matter. My player is at present using MS media player ocx to decode MP3's.
:p Kinjal :p
Hi Kinjal, No i'm not working on a mp3-player, no decoding, i'm just attaching a full featured lyrics displayer to winamp that integrates the tags into mp3's.