Click here to Skip to main content
15,861,125 members
Articles / Desktop Programming / Windows Forms

Professional Tag Editor for MP3 (ID3) and WMA

Rate me:
Please Sign up or sign in to vote.
4.85/5 (24 votes)
31 May 2009CPOL6 min read 118.2K   918   106   18
Provide libraries and application to manage tagging of ID3 and WMA

Introduction

ProTagEditor/MainDialog.jpg

Now a days, all audio files contain some type of content descriptions. Tagging feature adds some extra information to files, such as, title of song, album name, band logo, artist picture, etc. Each file type has its own structure to store these types of information.

MP3 files use ID3 (Identify an MP3) tagging. ID3 saves at the beginning or end of MP3 files and contains so much information about that. ID3 standard have some versions that each version is different from others. The last version until now is ID3v2.4. But ID3v2.3 is more common.

WMA files contain a specification for storing additional information such as Title, Album, picture, etc. The difference between ID3 and WMA tagging is that WMA natively supports additional information but MP3 file does not. MP3 files just support audio and need additional structure.

In this article, I have some libraries to read and write some WMA objects and ID3. My libraries support:

  • ID3v1
  • ID3v2.2
  • ID3v2.3
  • ID3v2.4
  • WMA Branding Object
  • WMA Content Description
  • WMA Extended Content Description

Because they are additional information to audio and they are not audio signals, we call them Tag information.

The .NET solution contains four projects:

  1. Tag: This project contains classes needed to read and write tag information.
  2. TagInfoControls: Provides many controls to view and edit Tag information and these controls can be used to design a professional Tag editor in just a minute.
  3. TagEditor: This is an application used in both previous projects to make a complete and professional ID3 and WMA tag editor.
  4. Setup: Makes setup to install and enjoy everything.

There are some samples for each type of project and how to use them. Here I have explained how this class works and how everyone can use it to view or edit tag information.

Some main features of current Editor are: 

  • Edit many files together 
  • Easy lyric editor 
  • Rename Files automatically according to their tag information with formula
  • Save some information as template and set the template to many files
  • Support right-to-left languages

In fact, this is the improved version of my previous article about ID3v2 on CodeProject. This article is also available on SourceForge.

Background

MP3 files don't have any trick to store additional information with them. So there is a data structure named ID3 to store this type of information with MP3 files. The story about the WMA files is different. They have a structure to store this type of information with them.

ID3 has different versions and the main reference for ID3 is www.ID3.org. The web site provides all information about all versions of ID3 and is available for everyone to download.

In fact, WMA files are ASF files. WMA is just an extension for ASF audio files. The ASF was developed by Microsoft and you can download the specification here.

To understand codes of this article, it is necessary to at least have basic information about ID3 and WMA files. But to use the codes of design tag editor with controls, there is no need to understand how ID3 and WMA files work.

Also there is some global information about both WMA and ID3 structure in my previous article on CodeProject and Sourceforge.

How TagEditor Works

As I read the specification of ID3 structure, I understood that there is so much likeness between ID3 different frames. As an example, all ID3 text information like "Title", "Artist Name", "Band Name" and so many other data don't have different structures.

Some tags have inheritable structure. One tag has information that the second one has the same in addition with another parts.

So it's rational to use classes to read and write ID3 information. For those tags that have similar structure, we use one class and for those that have inheritable structure, we use inheritance in classes.

The picture below shows the class structure of ID3v2.X tag editor. As you can see, all classes inherits Frame class as the main. Frame class is the heart of ID3v2 reading and writing.

ProTagEditor/InheritedDirectly.png

ProTagEditor/InherisUndirect.png

The same way is used for WMA files, but WMA has less classes.

Professional Tag Editor Features

Ready Controls

This library lets you create Full feature professional tag editor in just a minute because it contains many ready controls that can be used to make a tag editor.

For example, the picture below shows the TextInformation dialog of Professional Tag Editor application. This dialog just used ready TextInformation control in the controls project.  

ProTagEditor/TextInformation.jpg

ProTagEditor/AttachedPictures.jpg

Picture editor control that lets you manage attached image of MP3 files.

Automatic Rename

As it's very common to manage MP3 files, it's common to rename them. Sometimes renaming file is a time consuming work. So this application and classes let you rename files according to a special formula and the tag information of file. You can say rename file to "Artist Name - Track Number" as an example.

Loading Filter

There are so many times that you just want to read a special part of tag info. For example, you have an MP3 player application and you just want to read Title of song and Album name and there is no need to read every other information that the file includes. Professional Tag Editor lets you filter name of frames that you want to read or you don't want to read.

Template Support

The code supports using templates. You can store special ID3 or WMA information as a template and load it to every file you need. For example a publishing company always needs to add publisher text so they can use a template to store publisher information such as name, logo, pictures, web address, etc. and always copy that template to their release files.

Template is supported by professional tag editor application and all classes.

The picture below shows the template dialog of professional tag editor application:

ProTagEditor/TemplateEditor.jpg

Lyric

There is special support for lyric editing. There is a special control to manage synchronized and unsynchronized lyric. The picture shows a synchronized lyric editor control that is used inside a professional tag editor application.

ProTagEditor/Lyric.png

Unicode Support

I've tried to support right to left languages in every place of the application. Everywhere you can use Unicode as text. The application saves information in minimum length, or you can select encoding type.

Anywhere that you can use long text such as lyrics, there are features to user RTL languages and controls remember that language as RTL.

Try to Support Everything

ID3 contains many aspects that are not used with most applications. One of them is a general encapsulated file. This ID3 feature lets you add additional files to your MP3 file without concern about file type. These features are supported by my libraries but I really don't know the usage. One of my friends said if you attach too many images to an MP3 file, you can make a video extension! This feature is like that, I think.

Error Management

Some times tags contains some error and can't read properly. In this situation, classes let you know the occurred error and manage the errors.

Sample Code

Sample codes let you know how to use this library and they provide most aspects of using Professional Tag Editor.

More.........

For more information about this application and libraries, you can visit http://professionaltag.sourceforge.com.

History

  • 31st May, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWhere have the links gone. None work. Pin
Member 1282942026-Mar-19 3:47
Member 1282942026-Mar-19 3:47 
GeneralMy vote of 3 Pin
srfox1-Sep-14 20:15
professionalsrfox1-Sep-14 20:15 
Questionid3 tag editer attached picture Pin
Member 1044903828-Mar-14 18:00
Member 1044903828-Mar-14 18:00 
Questionsourcecode for FilterTextBox.dll, TagInfoControls.dll and HexBox.dll available? Pin
forumarbeit20-Dec-12 9:22
forumarbeit20-Dec-12 9:22 
BugBug: TXXX cannot be removed! Pin
toffee_paul22-Jan-12 13:06
toffee_paul22-Jan-12 13:06 
QuestionException if file contains a unknown frames ID3v2.x Pin
maddevil45-Dec-11 9:40
maddevil45-Dec-11 9:40 
Questionthankful for you Pin
amir 218-Jul-11 5:51
amir 218-Jul-11 5:51 
GeneralRemoving ID3v2 tag corrupts MP3 header Pin
prebsidk1-Feb-10 1:59
prebsidk1-Feb-10 1:59 
QuestionProblem saving VBR MP3 (Variable Bit Rate) Pin
amartinez2534-Dec-09 18:55
amartinez2534-Dec-09 18:55 
AnswerRe: Problem saving VBR MP3 (Variable Bit Rate) Pin
Jon_AC3-Jun-12 21:31
Jon_AC3-Jun-12 21:31 
GeneralSolution for compiler errors [modified] Pin
hgy5915-Nov-09 3:51
hgy5915-Nov-09 3:51 
GeneralBad SF link Pin
Ravi Bhavnani12-Aug-09 2:41
professionalRavi Bhavnani12-Aug-09 2:41 
NewsGreatly enhanced version if the author wants it ... Pin
sheckyboy11-Aug-09 8:23
sheckyboy11-Aug-09 8:23 
Generalpartially working Pin
Member 47391286-Jul-09 16:50
Member 47391286-Jul-09 16:50 
Generalserver error when running setup.exe Pin
nipsonanomimata28-Jun-09 7:57
nipsonanomimata28-Jun-09 7:57 
GeneralMy vote of 1 Pin
NeverJustHere20-Jun-09 21:29
NeverJustHere20-Jun-09 21:29 
QuestionNew ID3Tag Ver 2 Pin
Alaa Hadid11-Jun-09 0:06
Alaa Hadid11-Jun-09 0:06 
GeneralCompile Error [modified] Pin
strictly8631-May-09 16:55
strictly8631-May-09 16:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.