.NET FLAC library

Today I’ve released second version of sharpflac. This project is aimed to be .NET implementation of FLAC (Free Lossless Audio Codec). Fast implementation I should mention.

Currently the project is far from end and supports only reading of metadata blocks from FLAC files. So why second release? Because the core of this project is correct implementation of BitStream.

It tooked a while to port it from another jFlac opensource project. I’ve found nothing avaliable on the web (what a shame to .NET developers!) so porting was the only option for me (istead of writing it from scratch).

Now step by step I’m planning to port decoder, encoder and metadata writer. I wish there was another pair of hands in this project but the reality is sad.

Anyways, how to use this stuff you may ask? Let’s review current architecture and types for FLAC metadata:

 

FLAC metadata model

You can see, data model is extremely simple (though CUE Sheet metadata block is missing – it is still under development). Currently these metadata blocks are supported:

  1. Application
  2. Padding
  3. StreamInfo
  4. SeekTable
  5. VorbisComments
  6. Picture

In order to read metadata from FLAC file you should create FlacParser instance and call apropriative ReadMetadata() method.

Additionally ReadVorbisComments() method is provided for extremely fast reading of Vorbis Comments. Here is the example:

            FlacParser p = new FlacParser();
            FlacMetaData meta = p.ReadMetadata(@"Data\testFile.flac");
            VorbisComments comments = meta.VorbisComments;

            foreach (VorbisComment c in comments)
            {
                Console.WriteLine(c);
            }

Here is the output:

TITLE=Wanna Get Closer
ARTIST=Jeff Kashiwa, Kim Waters, Steve Cole
ALBUM=The Sax Pack, The Pack Is Back
DATE=2009
TRACKNUMBER=01
TRACKTOTAL=10
GENRE=Jazz

Simple, isn’t it? And this is really fast (especially when you need to read metadata from big bunch of FLAC flies).

I’m planning to add support of CUE Sheet metadata block very soon and start working on decoder.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.