RIFF (Resource Interchange File Format) is a file container format for storing data as tagged chunks. It is mainly used to store multimedia like video and audio. The chunk may include information such as the artist, the creation date, and copyright information, etc. This article will be guiding developers to extract metadata and RIFF INFO from the WAV audio files in C#.
The following topics will be covered in the article in brief:
- .NET API for Managing Metadata
- Extract Metadata of WAV Files in C#
- Extract RIFF INFO of WAV Files in C#
.NET API for Managing Metadata
In this article, I will be using GroupDocs.Metadata for .NET API in the C# examples for extracting metadata from WAV files. In addition to the audio WAV files, the API supports adding, removing, updating, and extracting metadata from MP3 files and videos. Furthermore, it supports Microsoft Office and Open Office file formats, eBooks, images, and many other document formats.
You can download the DLLs or MSI installer from the downloads section or install the API in your .NET application via NuGet.
PM> Install-Package GroupDocs.Metadata
Extract Metadata of WAV Files in C#
Let’s start with the extraction of the metadata from the WAV files. Follow the steps and the below-mentioned code example for extracting the WAV package metadata properties of WAV files in C#.
- Load the WAV audio file.
- Get the WavRootPackage of metadata.
- Extract the WavPackage from the root package.
- Now you can access all the properties of WAV audio.
Here is the output of the above code:
Bits per Sample: 16
Block Align: 4
Byte Rate: 176400
Number of Channels: 2
Audio Format: 1
Sample Rate: 44100
Extract RIFF INFO of WAV Files in C#
RIFF INFO of the WAV files can also be extracted in no different way than the extraction of WavPackage properties shown earlier. Using the following steps, you can extract the RIFF INFO of the audio file of WAV file format within your .NET application.
- Load the WAV audio file.
- Get the WavRootPackage of metadata.
- Extract the RiffInfoPackage from the root package.
- Now access the properties of WAV audio.
The following code example extracts the RIFF INFO package metadata properties of the WAV file in C#.
The following is the output of the above code:
Artist: GroupDocs
Comment: Sample WAV File
Copyright:
CreationDate: 2020-12-03
Software: Sound Forge
Engineer: SGEFFNER
Genre: Mystery
Conclusion
In short, it is very easy to take out the metadata and RIFF INFO from the WAV files in C#. After trying the above examples, think about developing your own metadata extractor .NET application like GroupDocs.Metadata App.
There are many more open-source examples available at GitHub Repository. Download the source code and quickly run the examples using the getting started guide. In case of any difficulty, visit the documentation or reach the support team any time on the forum.