McBain Posted April 10, 2003 Posted April 10, 2003 Does anyone have a VB.Net program that can read the ID-tags of mp3-files? Quote
Moderators Robby Posted April 10, 2003 Moderators Posted April 10, 2003 We don't share programs here, we share knowledge. If you're having problems with a piece of code, then we'll be glad to help. Quote Visit...Bassic Software
McBain Posted April 10, 2003 Author Posted April 10, 2003 Oooh Guess I should have realised that.... sorry It's just that I don't know where to start. I've found an example for .Net but i can't get it to work. Maybe some tips to get me started? Quote
*Gurus* Derek Stone Posted April 10, 2003 *Gurus* Posted April 10, 2003 The Windows Media 9 SDK includes this functionality. Look for the SDK on MSDN. Quote Posting Guidelines
dsgreen57 Posted April 11, 2003 Posted April 11, 2003 Check out Dunkan McKensie's coding 4 Fun Column on MSDN his first article was on a media player he had written, which reads ID3Tags... Or as mentioned by Derek you can use the Windows Media 9 SDK, which also provides the functionality but thought I would mention the above column as it is a nice article. Quote
otherside Posted April 11, 2003 Posted April 11, 2003 I'm currently writting a small API for that, but i'm having some problems with the bytes manipulation. Just some piece of infomation, the ID3 ver.1 it's very easy since the information has a characters limit per field and it's alsways written at the end of the mp3 file, starts at a specific number of bytes from the end. But the version 2 has some problems since there is no limit for the number of characters for each field, and also is written almost at the start of the file, Here the problems are two First of all you have to increase the size of the file which i don't how to do in VB. And second you have to find the specific charater which marks the end of the ID3v2, which until now i haven't been able to find. But the main problem is that you have to increase the size of the file starting in a specific byte of the file. Any ideas anyone.. let me know. Note: The only method i've considered is to read the whole file and then write it again which is not the best since the file can be very long like 100MBs which it wont be good to read it in the memory. Quote
McBain Posted April 12, 2003 Author Posted April 12, 2003 Well, using the SDK seems to be the easiest way but it doesn't work on all computers seems like you have to have the latest media player installed. Quote
McBain Posted April 12, 2003 Author Posted April 12, 2003 Found this example on msdn. Anyone who knows how to use it?koden till mp3vb.txt Quote
philprice Posted April 12, 2003 Posted April 12, 2003 *sigh* just look at the code and figure out the bits you want. Look at the methods that interet you, copy them into your own classes and alter them if needed. Quote Phil Price� Visual Studio .NET 2003 Enterprise Edition Microsoft Student Partner 2004 Microsoft Redmond, EMEA Intern 2004
McBain Posted April 15, 2003 Author Posted April 15, 2003 I've tried but it doesn't work. Why do you think im asking for help? Quote
otherside Posted April 15, 2003 Posted April 15, 2003 OK i wrote a litle part of code to help, this will read any ID3v1. and will put the fields in the variables txttitle etc. Imports System.IO Dim mp As FileStream Dim Title(30) As Byte Dim Artist(30) As Byte Dim Album(30) As Byte Dim Year(4) As Byte Dim Comments(30) As Byte mp = New FileStream("D:\mpdok.mp3", FileMode.Open) mp.Seek(-125, SeekOrigin.End) mp.Read(Title, 0, 30) mp.Seek(-95, SeekOrigin.End) mp.Read(Artist, 0, 30) mp.Seek(-65, SeekOrigin.End) mp.Read(Album, 0, 30) mp.Seek(-35, SeekOrigin.End) mp.Read(Year, 0, 4) mp.Seek(-31, SeekOrigin.End) mp.Read(Comments, 0, 30) Dim TxtTitle As String = System.Text.Encoding.ASCII.GetString(Title) Dim TxtArtist As String = System.Text.Encoding.ASCII.GetString(Artist) Dim TxtAlbum As String = System.Text.Encoding.ASCII.GetString(Album) Dim TxtYear As String = System.Text.Encoding.ASCII.GetString(Year) Dim TextComments As String = System.Text.Encoding.ASCII.GetString(Comments) The only thing that doesn't read is the genre which is a long story.. you can take a look on the link that explains about the ID3 genres that someone posted before. http://www.id3.org Quote
hercemer Posted August 6, 2003 Posted August 6, 2003 I have been trying this code for quite a while, but it always seems to return - "Title as opposed to Title (All the fields do this). It displays OK on a msgbox, but the Quote really messes it up when I try to add it to a listbox or database. Any help would be great, thanks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.