Project Description

Luminescence.Xiph is a full managed assembly developped in C# for reading and writing Vorbis Comment tags (including picture), contained in Ogg and native FLAC.

Introduction

Metatogger screenshot

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 Code

The 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:

Classes diagram

Tutorial

You can download a tutorial (in french) here: tutoriel-luminescence-xiph.pdf
You can prefer to read it online at Developpez.com.

Last edited May 5 at 8:00 PM by Cyber_Sinh, version 8