Project DescriptionLuminescence.Xiph is a full managed assembly developped in C# for reading and writing Vorbis Comment tags (including picture), contained in Ogg Vorbis, Ogg FLAC, Ogg Speex and native FLAC files.
Introduction
For my freeware project,
MetatOGGer, I needed a managed library to read and write tags contained in Ogg and FLAC streams. As I couldn't find any, I decided to write one myself.
The codecs supported by this library include Vorbis, FLAC and Speex. Technical informations about Ogg and FLAC files can also be gotten using this library.
Text tags will be stored in a
Dictionary<string, List<string>> because you can have several identical tags such as "artist," etc. Picture tags will be stored in a collection of
ID3PictureFrame with a
BitmapFrame property (Windows Imaging Component).
It's possible to read any raw data in an Ogg stream with the
OggPageReader class.
Using the CodeThe use of
OggTagger and
FlacTagger is very easy. The source code is fully documented (in French).
using Luminescence.Xiph;
var ogg = new OggTagger(@"C:\Song.ogg");
// Load duration
DateTime time = new DateTime(0);
time = time.AddSeconds(ogg.Duration);
// Tags manipulation
string artist = ogg.Artist;
ogg.Title = "My Immortal";
ogg.AddTag("LYRICS", "I am singing in the rain...");
ogg.SetTag("LYRICS", "I am not singing in the rain...");
ogg.RemoveTag("LYRICS");
Dictionary<string, List<string>> tags = ogg.GetAllTags();
BitmapFrame cover = ogg.FlacArts.FirstOrDefault(p => p.PictureType == ID3PictureType.FrontCover);
ogg.SaveMetadata();
Here is the diagram for main classes:
TutorialYou can download a tutorial (in french) here:
tutoriel-luminescence-xiph.pdfYou can prefer to read it online at
Developpez.com.