Thank you but i found something beter!
(comments are in dutch, witch is my native language)
Private Sub MP3InfoOphalen()
Try
' Een FileStream openen, gekoppeld aan het bestand
Dim strMP3 As New IO.FileStream(Me.BestandsNaam,
IO.FileMode.Open, IO.FileAccess.Read)
' Een BinaryReader gebruiken om binair uit de FileStream
karakters
' te lezen
Dim binReader As New IO.BinaryReader(strMP3)
' Als ze aanwezig is staat de MP3-informatie 127 bytes voor het
' einde van het bestand
binReader.BaseStream.Seek(-128, IO.SeekOrigin.End)
' Enkel en alleen als de eerste 3 bytes op die positie het woord
' TAG vormen bevat het bestand geldige MP3-informatie die we
kunnen
' eruit halen
If binReader.ReadChars(3) = "TAG" Then
msTitel = binReader.ReadChars(30) ' We lezen 30 karakters
voor de titel
msArtiest = binReader.ReadChars(30) ' We lezen 30 karakters
voor de artiest
msAlbum = binReader.ReadChars(30) ' We lezen 30 karakters
voor het album
msJaar = binReader.ReadChars(4) ' We lezen 4 karakters voor
het jaar
msCommentaar = binReader.ReadChars(30) ' We lezen 30
karakters voor het commentaar
Else
' Geen geldig MP3-bestand: velden wissen
msTitel = ""
msArtiest = ""
msAlbum = ""
msJaar = ""
msCommentaar = ""
End If
' De BinaryReader en FileStream sluiten
binReader.Close()
strMP3.Close()
Catch ex As IO.IOException
msTitel = ""
msArtiest = ""
msAlbum = ""
msJaar = ""
msCommentaar = ""
End Try
End Sub
Bart, the code below will only extract the ID3 v1 tag. The ID3 v2.3 tag is
quite a bit more complex. For a free .NET library to read and write both v1
and v2.3 ID3 tags, see my UltraID3Lib at www.hundredmilessoftware.com.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.