Read ID3 v1 tags from MP3 file


Thursday, October 26, 2023 Difficulty: Intermediate

Objective

Create a Java program that reads ID3 v1 specification tags from an MP3 music file. You should also check if the ID tag corresponds to the TAG characters of version 1.

ID3 specifications apply to any audiovisual file or container. However, audio containers are generally applied mainly. There are three versions of the specification that are compatible. For example, a file can contain tags simultaneously version 1.1 and version 2.0. In this case, the media player must decide which ones are relevant.

ID3 version 1

This first specification is very simple. It consists of attaching a block of fixed size of 128 bytes at the end of the file in question. This block contains the following tags:

  • An identification header with the characters "TAG".
  • Title: 30 characters.
  • Artist: 30 characters.
  • Album: 30 characters.
  • Year: 4 characters.
  • One comment: 30 characters.
  • Genre (musical): a character.

All tags use ASCII characters, except the genre, which is an integer stored in a single byte. The musical genre associated with each byte is predefined in the standard and includes definitions of 80 genres, numbered from 0 to 79. Certain reproduction programs have expanded on their own the defined genres (from number 80).

Input

Output

TAG
Impact Moderato
Nauj Llopir
YouTube Audio Library
1993

:

Solution

Click here to view the exercise solution

Share it

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

Copied

The code has been successfully copied to the clipboard.

More Exercises

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

1

Read ID3 v1 tags from MP3 file

Create a Java program that reads ID3 v1 specification tags from an MP3 music file.

2

Read dimensions of BMP image

Create a program in Java to read the dimensions of an image in Windows bitmap format.

3

Encrypt a BMP image

Create a program in Java to encrypt an image in Windows bitmap format.

4

Inverted file

Create a program in Java that inverts all the bytes of a binary file.

5

File copier

Create a Java program that makes copies of both text and binary files.

6

File splitter

Create a Java program that divides text or binary files into parts of 5 Kb each.

7

Hexadecimal viewer

Create a hexadecimal viewer in Java that shows the contents of a binary file on screen as follows.

Binary Files

Practice with exercises in Java to manage binary files. Learn how to create, update, and search binary files in different ways.

Practice exercises

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

Exercises C# App

Take your Exercises C# lessons everywhere with our Android app. Download it now from Google Play