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 Java
// Extract Metadata of WAV files in Java
try (Metadata metadata = new Metadata("audio.wav"))
{
WavRootPackage root = metadata.getRootPackageGeneric();
System.out.println(root.getWavPackage().getBitsPerSample()); // Bits per Sample
System.out.println(root.getWavPackage().getBlockAlign()); // Block Align
System.out.println(root.getWavPackage().getByteRate()); // Byte Rate
System.out.println(root.getWavPackage().getNumberOfChannels()); // No. of Channels
System.out.println(root.getWavPackage().getAudioFormat()); // Audio Format
System.out.println(root.getWavPackage().getSampleRate()); // Sample Rate
}
// Extract RIFF INFO of WAV files in Java
try (Metadata metadata = new Metadata("audio.wav"))
{
WavRootPackage root = metadata.getRootPackageGeneric();
System.out.println(root.getRiffInfoPackage().getArtist()); // Artist
System.out.println(root.getRiffInfoPackage().getComment()); // Comment
System.out.println(root.getRiffInfoPackage().getCopyright()); // Copyright
System.out.println(root.getRiffInfoPackage().getCreationDate()); // Creation Date
System.out.println(root.getRiffInfoPackage().getSoftware()); // Software
System.out.println(root.getRiffInfoPackage().getEngineer()); // Engineer
System.out.println(root.getRiffInfoPackage().getGenre()); // Genre
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment