TagLib to write ID3v2 Tags in Xojo
With our TagLibFileRefMBS class you can read properties of an audio file including all the common values like artist, title, album or comment. We now got a setProperties method to update the properties and add/change/delete a few. Just pass in the dictionary with changes. Keys with nil values remove an entry and otherwise add or replace it:
Dim file As FolderItem = SpecialFolder.Desktop.Child("test.mp3")
Dim tag As New TagLibFileRefMBS(file)
Dim dic As Dictionary = tag.Properties
Break // inspect dictionary
dic.Value("ARTIST") = "John Doe"
dic.Value("ALBUM") = Nil // clear this one
tag.SetProperties(dic)
If tag.Save Then
MsgBox "OK"
Else
MsgBox "Failed to save"
End If
Currently TagLib supports both ID3v1 and ID3v2 for MP3 files, Ogg Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF files.