Results 1 to 8 of 8

Thread: How to get MP3 ID3 Tags

  1. #1
    Guest

    MP3 Tag help

    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

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    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.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Post

    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest

    Question

    Thanks for the code, but how do I put it into my prog??? I tried but i don't quite understand it.

    ~~~~~~~
    AGbsa84

  5. #5
    Guest

    A question for Kedaman

    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?

  6. #6
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270
    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
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  7. #7
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Talking

    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.


    Kinjal

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width