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:
- 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:
- Tag: This project contains classes needed to read and write tag information.
- 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.
- TagEditor: This is an application used in both previous projects to make a complete and professional ID3 and WMA tag editor.
- 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.
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.
The same way is used for WMA files, but WMA has less classes.
Professional Tag Editor Features
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.
Picture editor control that lets you manage attached image of MP3 files.
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.
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.
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:
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.
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.
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 codes let you know how to use this library and they provide most aspects of using Professional Tag Editor.
For more information about this application and libraries, you can visit http://professionaltag.sourceforge.com.
- 31st May, 2009: Initial post
I began programming with C/C++ when i was 15. Then try to learn VC++ but at the middle of my reading .NET came.
I began to read C# and VB.NET and also began designing basic websites by FrontPage and developed some websites for our school and some other companis.
Later learn Microcontroller and design some digital circuits with PIC microcontrollers for a industrial controller company.
As I learned SQL and ASP.NET developed some website such as news portals that are active now.
Now i'm a software student and teach programming in computer institues. And have my own job by getting projects from companies.