Last active
March 22, 2021 12:57
-
-
Save GroupDocsGists/da2d3e1b0d6c1d2724d2057eddacd7c7 to your computer and use it in GitHub Desktop.
Extract Metadata and RIFF INFO of WAV files in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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