AuthorMessage
b_w_johan
Regular
Posts: 56

For my mediaplayer im looking for a way to pint the ID3 tag in textfield or scroll thingy.
im looking at all kinds of source examples but i can't find a way to actual get the ID3 tag parts ...
when i check other forums they hve complete mp3 players for download but nothing is mentioned about actually getting the ID3 tag.
i only need Title - singer - album (year place and other stuff not important and i need from ID3 V1 only the 2nd part i don't use for my music )
hope someone can help me with it Johan
bluebear
n00b
Posts: 32

That is easy.
1 Open mp3 file
2. search for "TAG" (search from file end)
3. From next 125 bytes after "TAG" is the data you want.
The first 30 bytes is the song title.
Next 30 bytes is the artist
Next 30 bytes us album
Next 4 bytes is the year
Next 30 bytes is the comment
last byte is genre
but you should have support for all tag versions.
So as you see its v.simple.. all you need to know is how to read a file...
b_w_johan
Regular
Posts: 56

hmmmm i don't really know how to do that YET, but ill try to find some source examples wich i can use perhaps, if you know how to do it perhaps you can post example on how to read ??
b_w_johan
bluebear
n00b
Posts: 32

For crying out loud... You really need yo learn how to figure stuff out yourself.
Every question you ask indicate that you don't understand programming at all. I assume you havent even bothered to read the beginners book.  It's evidently cause the questions you ask are in the first pages of the beginners book.
Code:
' String lengths
Const TAGID As Integer = 3
Const Title As Integer = 30
Const Artist As Integer = 30
Const Album As Integer = 30
Const year As Integer = 4
Const Comment As Integer = 30
Const Genre As Integer = 1
Private Sub GetGenreStr(ByRef g As Byte, ByRef s As String)
    ' Fimish this your self
    Select Case g
        Case 0
            s = "Blues"
        Case 1
            s = "ClassicRock"
        Case 2
            s = "Country"
        Case 3
            s = "Dance"
        Case 4
            s = "Disco"
        Case 5
            s = "Funk"
        Case 6
            s = "Grunge"
        Case Else
            s = "Unknown"
        End Select
                'HipHop = 7
        'Jazz = 8
        'Metal = 9
        'NewAge = 10
        'Oldies = 11
        'Other = 12
        'Pop = 13
        'RnB = 14
        'Rap = 15
        'Reggae = 16
        'Rock = 17
        'Techno = 18
        'Industrial = 19
        'Alternative = 20
        'Ska = 21
        'DeathMetal = 22
        'Pranks = 23
        'Soundtrack = 24
        'EuroTechno = 25
        'Ambient = 26
        'TripHop = 27
        'Vocal = 28
        'JazzFunk = 29
        'Fusion = 30
        'Trance = 31
        'Classical = 32
        'Instrumental = 33
        'Acid = 34
        'House = 35
        'Game = 36
        'SoundClip = 37
        'Gospel = 38
        'Noise = 39
        'AlternRock = 40
        'Bass = 41
        'Soul = 42
        'Punk = 43
        'Space = 44
        'Meditative = 45
        'InstrumentalPop = 46
        'InstrumentalRock = 47
        'Ethnic = 48
        'Gothic = 49
        'Darkwave = 50
        'TechnoIndustrial = 51
        'Electronic = 52
        'PopFolk = 53
        'Eurodance = 54
        'Dream = 55
        'SouthernRock = 56
        'Comedy = 57
        'Cult = 58
        'Gangsta = 59
        'Top40 = 60
        'ChristianRap = 61
        'PopFunk = 62
        'Jungle = 63
        'NativeAmerican = 64
        'Cabaret = 65
        'NewWave = 66
        'Psychadelic = 67
        'Rave = 68
        'Showtunes = 69
        'Trailer = 70
        'LoFi = 71
        'Tribal = 72
        'AcidPunk = 73
        'AcidJazz = 74
        'Polka = 75
        'Retro = 76
        'Musical = 77
        'RocknRoll = 78
        'HardRock = 79
        'None = 255
End Sub
Private Sub Form_Load()
    Dim sTag As String
    sTag = String(TAGID, " ")
   
    Dim sTitle As String
    sTitle = String(Title, " ")
   
    Dim sArtist As String
    sArtist = String(Artist, " ")
   
    Dim sAlbum As String
    sAlbum = String(Album, " ")
   
    Dim sYear As String
    sYear = String(year, " ")
   
    Dim sComment As String
    sComment = String(Comment, " ")
   
    Dim bytGenre As Byte
   
    Dim iFileNo As Integer
    iFileNo = FreeFile()
   
    Dim filePos As Long
    Open "c:\test.mp3" For Binary As iFileNo
       
        filePos = LOF(iFileNo)
       
        If filePos < 128 Then GoTo NoTag
       
        filePos = filePos - 127
        'Check if there is a tag
        Get iFileNo, filePos, sTag
        If sTag <> "TAG" Then GoTo NoTag
       
        'Title
        filePos = filePos + TAGID
        Get iFileNo, filePos, sTitle
       
        'Artist
        filePos = filePos + Title
        Get iFileNo, filePos, sArtist
       
        'Album
        filePos = filePos + Artist
        Get iFileNo, filePos, sAlbum
       
        'Year
        filePos = filePos + Album
        Get iFileNo, filePos, sYear
       
        'Comment
        filePos = filePos + year
        Get iFileNo, filePos, sComment
       
        'Genre
        filePos = filePos + Comment
        Get iFileNo, filePos, bytGenre
       
        'Display data
        MsgBox ("Title: " & sTitle)
        MsgBox ("Artist: " & sArtist)
        MsgBox ("Album: " & sAlbum)
        MsgBox ("Year: " & sYear)
        MsgBox ("Comment: " & sComment)
        Dim str As String
        GetGenreStr bytGenre, str
        MsgBox ("Genre Cat.: " & str)
NoTag:
    Close iFileNo
End Sub

b_w_johan
Regular
Posts: 56

Thank you =-p
hmmm youre right perhaps i SHOULD open that book one time hehe =-p
ill try to find out myself before asking, and ill add code of what im trying to do so you see i'm trying atleast hehe =-p
now i yust tried to copy working parts and make "MY" version hehe.
TY anyway hope you still help me by next Question  :wink:
b_w_john
--edit
btw you know any sites with explanation instead of source examples ??
cause there must be something like lua.org to ....  google only shows links to buy books.... isn't there a page for that ?
bluebear
n00b
Posts: 32

btw you know any sites with explanation instead of source examples ??
cause there must be something like lua.org to ....  google only shows links to buy books.... isn't there a page for that ?[/quote]
There are many good articles at http://www.codeproject.com/ wich has both source and explanatins. Else msdn.microsoft.com has online manuals for c++,vb,.net and more wich also has explanations and source samples