Special thanks to Manoj Khanna who has alerted me that the "details" I referred to in this question are actually called ID3 Tags
. Part of the reason I needed the community's help was because I didn't know the name of these tags, so thank you for responding to my question! You guys are a huge help!
I created a simple Java application (in Java 8) that plays .WAV Audio Files
stored on my computer. I use the javax.sound.sampled.AudioSystem
to play a javax.sound.sampled.Clip
using this code:
Clip l = AudioSystem.getClip();
l.open(AudioSystem.getAudioInputStream(new File("song.wav")));
l.setFramePosition(0);
l.start();
That code works completely fine, and I am very happy with how it works. I get the name of the file to identify the songs, and it works well. However, what I am asking for help with is how to use the .WAV Audio File
's song "details" and "information."
This is a bit hard to explain, so I will use include pictures and specific applications to clarify.
Other audio applications (as an example, I will use Microsoft's "Groove Music" app in Windows 10) send the "details" of the track to the speakers and the operating system.
IMAGE ONE: You can set the "details" of an audio track in the properties of a file, or set them when you create the file. This hyperlink links to a screenshot showing the "details" of the song (the title and contributing artists). Notice that the name of the file has nothing to do with the details shown in the image linked about (even though I named them the same).
IMAGE TWO: The "details" of the track are reflected while the song is playing in most audio playing applications (in this case "Groove Music"). The details are also reflected in the volume changing menu on the top left of the screen. This hyperlink links to a screenshot showing how the "details" are reflected while the track is playing. The same "details" would be sent to a Bluetooth audio playback device (such as a car or speaker), and possibly displayed on the device's screen (if the device has that feature).
As of now, my Clip
does not take any of the information from the properties of the .WAV Audio Files
and doesn't pass them along to my operating system or any of my speakers that I have tested it on. They all play the music fine, they just don't display the information as I'd like.
Is there any way for me to use these ID3 tags while playing the audio? I'd be fine with a solution where I'd have to manually set the song name and artist, or change a setting that automatically collects the information from the properties of the file.
I already have the ID3 tags set up in my audio file, but I want to pass these tags to the operating system and speakers when playing using the Clip. I want my Clip to play in a way that uses the information as shown in image two. I want the ID3 Tags already set up previously to be used when playing the audio file; I want the tags to be passed to the speakers and operating system while playing.
I would prefer not to use an external library, but if I must, than I can settle for using one.
Is this possible, and if so, how?
The properties that you would like to read or modify are called ID3 tags.
A quick Google search gave me this library JAudiotagger. It can also be used to read or modify ID3 tags of several other formats too.
Usage
AudioFile file = AudioFileIO.read(new File("filename.wav"));
Tag tag = file.getTag();
tag.setField(FieldKey.ARTIST,"Kings of Leon");
AudioFileIO.write(file);
More examples can be viewed here.