Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extract Metadata and RIFF INFO of WAV files in C#
// Extract Metadata of WAV files in C#
using (Metadata metadata = new Metadata("audio.wav"))
{
var root = metadata.GetRootPackage<WavRootPackage>();
Console.WriteLine("Bits per Sample: " + root.WavPackage.BitsPerSample); // Bits per Sample
Console.WriteLine("Block Align: " + root.WavPackage.BlockAlign); // Block Align
Console.WriteLine("Byte Rate: " + root.WavPackage.ByteRate); // Byte Rate
Console.WriteLine("Number of Channels: " + root.WavPackage.NumberOfChannels); // Number of Channels
Console.WriteLine("Audio Format: " + root.WavPackage.AudioFormat); // Audio Format
Console.WriteLine("Sample Rate: " + root.WavPackage.SampleRate); // Sample Rate
}
// Extract RIFF INFO of WAV files in C#
using (Metadata metadata = new Metadata("audio.wav"))
{
var root = metadata.GetRootPackage<WavRootPackage>();
Console.WriteLine("Artist: " + root.RiffInfoPackage.Artist); // Artist
Console.WriteLine("Comment: " + root.RiffInfoPackage.Comment); // Comment
Console.WriteLine("Copyright: " + root.RiffInfoPackage.Copyright); // Copyright
Console.WriteLine("CreationDate: " + root.RiffInfoPackage.CreationDate); // Creation Date
Console.WriteLine("Software: " + root.RiffInfoPackage.Software); // Software
Console.WriteLine("Engineer: " + root.RiffInfoPackage.Engineer); // Engineer
Console.WriteLine("Genre: " + root.RiffInfoPackage.Genre); // Genre
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment