Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Posted
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.
Posted
*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.

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

Posted

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

  • 3 months later...
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...