RIFF file container format used to store audio and video multimedia. This data stored in chunks can include lots of information such as the creation date, copyright information, artists, comments, etc. You can programmatically manipulate the metadata as well as RIFF INFO. This article guides developers to programmatically extract metadata and RIFF INFO from the WAV audio files in Java.

The following topics are covered in the article in brief:

Java API for Managing Metadata and RIFF INFO

GroupDocs.Metadata for Java is the metadata automation and manipulation API for various document and image file formats. I will be using this API to extract metadata and RIFF INFO 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 also supports Microsoft Office and Open Office file formats, eBooks, images, and many other document formats.

Download and Configure

Get the library from downloads or just add the following pom.xml configuration in your Maven-based Java applications to try the below-mentioned examples. For the details, you may visit the API Reference.

<repository>
	<id>GroupDocsJavaAPI</id>
	<name>GroupDocs Java API</name>
	<url>http://repository.groupdocs.com/repo/</url>
</repository>
<dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-metadata</artifactId>
        <version>21.2</version> 
</dependency>

Extract Metadata of WAV Files in Java

The following steps and the below-mentioned Java code example extract the metadata of the WAV files.

  • Load the WAV audio file.
  • Get the WavRootPackage of metadata.
  • Extract the WavPackage using getWavPackage method.
  • Now you can access all the properties of WAV audio.

The above code produces the following output with the provided wav file:

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 Java

If you want to extract the RIFF INFO of the WAV files, you can get it within your Java application using these steps. This is similar to the way we extracted the metadata shown above.

  • Load the WAV file.
  • Get the WavRootPackage of metadata.
  • Extract the RiffInfoPackage from the root package.
  • Now the properties of WAV audio are accessible.

The following code example extracts the RIFF INFO package metadata properties of the WAV file in Java.

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 this article, we discussed how to programmatically extract metadata and RIFF INFO from WAV audio files in Java. I hope you find it quite simple. Now you can build your own metadata extractor Java application using GroupDocs.Metadata for Java.

More about the API

Let’s clear any doubts @ Free Support Forum.

See Also