FLACSharp 1.0.0

dotnet add package FLACSharp --version 1.0.0
                    
NuGet\Install-Package FLACSharp -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FLACSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FLACSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="FLACSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FLACSharp --version 1.0.0
                    
#r "nuget: FLACSharp, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FLACSharp@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FLACSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=FLACSharp&version=1.0.0
                    
Install as a Cake Tool

FLACSharp

This is a simple, low-level binding to FLAC.dll / libFLAC.so from C# using Platform Invoke.

In order to use it, a platform-appropriate copy of the native FLAC library (FLAC.dll on Windows, libFLAC.so on Linux / FreeBSD / OS X) will need to be in the loader path or current directory.

Using

To use this library, add a NuGet package reference to FLACSharp. Then, call FLAC library methods as you would from a C/C++ project via the libFLAC.NativeMethods class.

The metadata structures make heavy use of unions, which aren't terribly well-supported by Platform Invoke.

  • Reading: The marshalling of metadata structures using the StreamMetadata class will decode the union bytes into all possible interpretations (the members of StreamMetadata.Data). Use the one appropriate to the Type.

  • Writing: Separate classes matching the layout specific to each type are provided. Use the appropriate type, e.g. StreamMetadata_with_StreamInfo, StreamMetadata_with_Application. A helper thunk is provided that allows you to supply a StreamMetadata[] to FLAC__stream_encoder_set_metadata and have the data be marshalled polymorphically.

Samples

Some simple proof-of-concept sample applications can be found in the Samples subdirectory of the library's source code repository (see below).

Completeness

As of this writing, this library is thrown together extremely hastily in one afternoon. It has been observed to successfully encode and decode FLAC data, but it has not been extensively tested and not all FLAC features have been exercised. If you want to use a feature and it doesn't work properly, open up a Git Issue, or, if you're up for it, code up a fix and make a Pull Request.

Source Code

The repository for this library's source code is found at:

License

The library is provided under the MIT Open Source license. See LICENSE.md for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 159 7/15/2025