Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Edit MP3 ID3 Tags in C#?

Edit MP3 ID3 Tags in C#?

Scheduled Pinned Locked Moved C#
csharpquestionannouncementcareer
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ethanwa
    wrote on last edited by
    #1

    Anyone know a good place to find a DLL/Project that I can import into my Solution that allows me to edit an ID3 tag in an MP3? Currently out there the pickings are slim for anything that updates version 2 tags. I want something simple that I can reference like this: using ID3Edit; private void Get() { ID3Tag id3Tag = new ID3Tag(); id3Tag.GetV2andV1Tag("C:\\test.mp3"); txtTitleV2.Text = id3Tag.TitleV2; txtTitleV1.Text = id3Tag.TitleV1; } private void Save() { id3Tag.TitleV2 = txtTitle.Text; id3Tag.UpdateV2Tag("C:\\test.mp3"); } I would be willing to pay $100 or so if someone could create a DLL like this for me within the next few days. I bet many other people out there are willing to pay for it as well. If you know of something that's already created in C# that is as easy to use as my above code, email me right away. I just don't have the time or knowledge to put something like that together. Email me for details if you want the job or if you have a DLL like this: Ethan ethanwa@comcast.net

    N 1 Reply Last reply
    0
    • E ethanwa

      Anyone know a good place to find a DLL/Project that I can import into my Solution that allows me to edit an ID3 tag in an MP3? Currently out there the pickings are slim for anything that updates version 2 tags. I want something simple that I can reference like this: using ID3Edit; private void Get() { ID3Tag id3Tag = new ID3Tag(); id3Tag.GetV2andV1Tag("C:\\test.mp3"); txtTitleV2.Text = id3Tag.TitleV2; txtTitleV1.Text = id3Tag.TitleV1; } private void Save() { id3Tag.TitleV2 = txtTitle.Text; id3Tag.UpdateV2Tag("C:\\test.mp3"); } I would be willing to pay $100 or so if someone could create a DLL like this for me within the next few days. I bet many other people out there are willing to pay for it as well. If you know of something that's already created in C# that is as easy to use as my above code, email me right away. I just don't have the time or knowledge to put something like that together. Email me for details if you want the job or if you have a DLL like this: Ethan ethanwa@comcast.net

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      I will get you started and then let you finish up, this is really not a difficult task. If you read ID3 made easy[^], they explain the byte layout for the ID3 tag within a file. If you have further questions please feel free to post here. The following should get the ID3 tag out of your file:

      class ID3Tag
      {
      public string title;
      public string artist;
      public string album;
      public string year;
      public string comment;
      public string tracknumber;
      public string genre;
      }

      private ID3Tag GetTag(string file)
      {
      string strTag = string.Empty;
      ID3Tag tag = new ID3Tag();
      ASCIIEncoding encoding = new ASCIIEncoding();
      FileStream fs = new FileStream(file, FileMode.Open);
      if(fs != null)
      {
      byte[] block = new byte[128];
      fs.Seek(-128, SeekOrigin.End);
      fs.Read(block, 0, 128);
      fs.Close();

          strTag = encoding.GetString(block);
          if(strTag.Substring(0,3) == "TAG")
          {
              tag.title = strTag.Substring(3, 30);
              tag.artist = strTag.Substring(33, 30);
              tag.album = strTag.Substring(63, 30);
              tag.year = strTag.Substring(93, 4);
              tag.comment = strTag.Substring(97, 28);
              if(strTag\[125\] == 0)
              {
                  tag.tracknumber = strTag\[126\];
              }
              else
              {
                  tag.tracknumber = 0;
              }
              tag.genre = strTag\[127\];
          }
      }  
      return tag;
      

      }

      HTH - Nick Parker
      My Blog | My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups