Hey Fellow Programmers:
Is there a way I can extract ID3 tags from MP3s using VB? Like Album, Artist, Genre, Comments??
Please help...thanks
Printable View
Hey Fellow Programmers:
Is there a way I can extract ID3 tags from MP3s using VB? Like Album, Artist, Genre, Comments??
Please help...thanks
Thank you very much Kadaman!! That was much appreciated.
I was wondering if there was a way I could make the program search for all MP3 files in a directory and look extract the ID3 tag from each one into a file or database?
You could use the dir function to retrieve the files, or the fso object
thanks
I have a question about your code
Before splitting up the ID3TAG into various parts, I just tried to show ID3TAG in a label. It didn't work. How do I see the contects of 'astring' or hte variable ID3TAG?
it's probably a nullchar there blocking the content, or maybe the text disappeared on another line in the label, it's a bit hard to tell you from here. Try to break somewhere and put ?id3tag in your immediate box
ok, I got it to read any mp3 file i select and show my the Id3tag.
Now my second question is how can i select a directory, and make hte program search thru the directory for all mp3 files and read their ID3tag and put it in a database?
I know i have to use a loop, but i'm not sure as to how to check for any file that ends in *.mp3 and check it's id3tag?
Ok, this will retrieve the all the mp3files from your path, and put them into a database where the "..." areCode:a=dir(path & "\*.mp3"
do while len(a)
If Left(ID3TAG(a), 3) = "TAG" Then ...
a=dir
loop
thanks a lot Kedaman!
Just wondering but how did you know what the offsets are to get the information from the ID3 tag? Like which part shows the artist, album and stuff?
Also that file finding code you gave, does it work with subdirectories too? Or just one level?
Thanks again. I'll try out the code when I get home.
I was hexaediting a mp3 file when i suddenly noticed that there was text stored in the end of the file. So i made my first ID3Tag editor.
No it doesn't work with subdirs i have posted the code somewhere recently, go search for it
greetings,
of what use exactly is the raw hex of an mp3? not meaning to be critical, but it intrigues me. what's in there that's recognizeable?
on a semi topic related note, would this code still work if the mp3 were in use (ie: playing) and can you write to the ID3 tag in this fashion?
Heh, i actually didn't get anything of it, i just was testrunning my own hexaeditor on it. The mp3 encryption is evil. No, you can't change the running mp3, at least if it's playing or even paused in winamp. But i've got around that problem
hey madd indian, maybe this snippet is of some use
(recursing subdirectories looking for mp3s...)
'just some helpfuncs...
Private Function fileSuffix(fileName As String) As String
Dim Index As Integer
Index = InStrRev(fileName, ".")
fileSuffix = Mid(fileName, Index, 4)
End Function
Private Function removeSuffix(fileName As String) As String
Dim Index As Integer
Index = InStrRev(fileName, ".")
removeSuffix = Left(fileName, Index - 1)
End Function
Private Function addDir(path As String)
Dim fileName As String
fileName = Dir$(path + "\*.mp3")
Do While fileName <> ""
If fileSuffix(fileName) = ".mp3" Then
Call addToMp3s(path, fileName)
End If
fileName = Dir$
Loop
End Function
Private Function recurseSubdirectories(path As String)
Dim subDirs() As String
Dim nofSubdirs As Integer
Dim directory As String
Dim i As Integer
displayInStatusBar ("Searching in " + path + "\")
Call addDir(path)
nofSubdirs = 0
directory = Dir$(path + "\", vbDirectory)
Do While directory <> ""
If (GetAttr(path + "\" + directory) And vbDirectory) = vbDirectory Then
If directory <> "." And directory <> ".." Then
ReDim Preserve subDirs(nofSubdirs + 1)
subDirs(nofSubdirs) = directory
nofSubdirs = nofSubdirs + 1
End If
End If
directory = Dir$
Loop
For i = 0 To nofSubdirs - 1
Call recurseSubdirectories(path + "\" + subDirs(i))
Next i
Erase subDirs
End Function
Just for info a great place to get information about the format of ANY (almost) file is at http://www.wotsit.org/ for MP#'s specifically http://www.wotsit.org/search.asp?page=5&s=music
This place rocks
Zevlag
note, it's been 11 months since he got what he wanted.