Editing music files metadata, ID3 tags, etc.

Hello !

Big newb here. And ambitious. I’m willing to enter in a domain of computers sciences that I’ve totally no idea where to start. I do have very little experience in C++, going to start Java this summer, started using Ubuntu this week, and I know the difference between a bit and a byte.

I might not ask all the detailed questions at first, so the main thing I’m looking for (for now) is documentation and sources of information (I’ve just read a bunch of stuffs on wiki, but that’s all).


What I want to do :

  • Learn how music files are structured (especially MP3 since that’s what I want to work with - but might require overall knowledge on simplier formats, I guess)
  • Learn to edit the data that isn’t music, but information (called metadata I believe). I’m not talking about changing the artist’s name in iTunes, but I want to completely change those data as I wish, work with my own file structure or whatever, for an entirely personal purpose. So I assume I’ll have to look deeper into what each bit is for, etc. etc. But I have time to learn.

Any thing that can get me further in my project is greatly appreciated !
Thanks !

I don’t know exactly how to do this, but I’ve done some programming (but not java) and I think I can get you started…

Programming isn’t that easy, and you need to know some basics before you jump-in and start trying to read/write ID3 tags. The real basics of programming are variables, loops, and branching (“if” statements). Of course, you’ll have to know some file I/O too. Do you have Java book? Once you learn those basic concepts, you can start to understand how programs “work”, and you should have an idea of how your program is going to work. (i.e. You could make a flow chart or a [u]psudocode[/u] outline.).

Programming is like any other subject, that there are concepts and terminology to learn… The first class is usually the hardest. And programming is unlike any other subject. Some people never really “get it”, and some people (most people?) just don’t like it!

It’s probably not that hard to write a “simple” tagging program, but It’s going to take some time and I’d guess it’s the kind of project you’d typically do at the end of your 2nd semester of programming. But, if you’re interested & motivated you could probably do it during your 1st semester.

If you wanted to write a “good” tagging program that handles all of the ID3 variations, and all of the popular audio formats (MP3, AAC, OGG, FLAC, etc.) and one that handles unicode (foreign characters), and a program that doesn’t crash when someone enters invalid information… That’s a bigger project.

First, you need to know how to open & read a file. Since the audio files are relatively large, it would be helpful if you can write a little program to scan-through the file and find the tag headers. (Actually, I don’t know if “header” is the correct term.) Once you can “find” the tags, it should be fairly easy to displays the information the tags.
After your program can read & display the tag information, you can work on editing & adding tags.

A [u]Hex Editor[/u] might be useful. If you are going to program, a hex editor is a useful tool. It allows you to look “inside” files in Hex format, and it also shows the ASCII (text) representation for any values that convert to text. The hex editor doesn’t know the context of the file data, so it shows the ASCII character, even if the value doesn’t actually represent text in the file… i.e. Every time is sees the value 41 hex (65 decimal), it shows an upper case ‘A’.

I’d start with [u]Wikipedia[/u] has some good information, although you’re not going to know what to do with the information 'till you learn a little about opening files with a program.
[u]MP3-converter.com[/u] has some fairly detailed information about MP3 files.
[u]ID3.org[/u] has tons of information.
[u]MP3 Tag Tools[/u] is an open source project, so you can study the code.

**P.S.**The biggest mistake most beginning programmers make is to write the whole program at once. They end-up with hundreds of errors, and when one error is fixed another error shows-up. The trick is to write, compile, and test a few lines at a time. For example, write empty “dummy” functions that simply display a message, like “I’m in Funtction 1” and return a valid dummy-value (if there is a return value). Then start adding real functionality to the function 'till it does everything it’s supposed to do. It’s always helpful to display variables and other informatinon about what the function is doing. Once your function/program is working properly you can comment-out all of this “debug” information.

Hey, thanks for your reply :slight_smile:

  • I do know some basics of programming in C++, I can easily deal with simple loops, functions, basic arrays, I/O values, and have little experience with I/O files (reading text files), but no experience with graphical interface, pointers, etc. (and the rest lol, those 2 ones are just chapters I have heard about). I also happen to have experience with MSL, and AHK. And fortunately I’m not part of the people who “hate” programming :stuck_out_tongue:

  • “simple” tagging program and “good” tagging program — I don’t know, but I assume I can start with the simple one haha.

  • I’ll look forward into this Hex Editor, although it’s more like a tool that I will try once I know where to start first


    — So basically you’re suggesting to deal with audio files using a common programming language such as C++, and making my own program ? If so, is it something I could do using only the terminal ? (All I can do with C++ is some .exe that I run on the command prompt, I have no idea how else I can adapt C++ to something else :stuck_out_tongue: )

To learn about id3 tags (metadata in MP3 files) ID3.org is the place to look. http://www.id3.org/

Well, (just in case we would go in a wrong direction), apparently ID3 tags are specific to certain standard files format like mp3. I do not know yet what I will learn from id3.org nor how are id3 tags exactly, but what I’m looking for is to do it entirely my way, like if I was actually creating a new type of audio file, which only differs from other ones by the metadata. So if id3.org will teach me how to edit tags in a way that is already standardized or has already some kind of predefined structure, that’s not my final aim.

(Maybe my title was misleading then?)

Anyways, it’s on my list of stuffs to read, will start tomorrow morning :wink: Thanks all so far!