Last active
March 22, 2021 13:02
-
-
Save GroupDocsGists/552bcf386d713c4751cde35ee85d043c to your computer and use it in GitHub Desktop.
Extract Metadata and RIFF INFO of WAV files in Java
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 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 | |
} |
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 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