Write Tag Info to a file

In order to make changes to a files metadata you make modifications to the tag class and then commit the changes


AudioFile f = AudioFileIO.read(testFile);
Tag tag = f.getTag();
tag.setArtist("Kings of Leon");
f.commit();

or alternatively use the write method()


AudioFile f = AudioFileIO.read(testFile);
Tag tag = f.getTag();
tag.setArtist("Kings of Leon");
AudioFileIO.write(f);

For the very common fields that all audio formats support we've provided some convenience methods. The set methods will replace the first field of this type or add a field if it doesnt already exist.

  
tag.setArtist("King of the Slumns));
tag.setAlbum("Barbarous English Fayre"));
tag.setTitle("Fanciable Headcase"));
tag.setComment("Rocking"));
tag.setYear("1988"));
tag.setTrack("5"));	

The list includes all Musicbrainz fields


tag.set(tag.createTagField(TagFieldKey.MUSICBRAINZ_TRACK_ID,"e785f700-c1aa-4943-bcee-87dd316a2c31"));