How to Play Music Using Java (Simple)
Max O'Didily
How to Play Music Using Java (Simple)
Greetings, today we shall be playing music using Java. This version works in recent Java versions where sun.audio was removed. This method can't play .mp3 files! The recommended audio file to use is .WAV but SND, and AIFF are also compatible.
To play music using Java, we simply need to create an AudioInputStream and create a clip object. We can then pass the AudioInputStream into the clip object and then tell the clip to play the music. Think of this like picking up a CD, opening a CD player, placing the CD into the CD player and pressing play to play the music. A possible dated example but might help understand what is going on.
This tutorial just covers how to play audio from a specified filepath. This tutorial doesn't cover how to loop audio, stop, pause and more.
If you want to see the follow up to this tutorial wehre we cover how to Loop, Pause and Stop Audio, click this link: https://www.youtube.com/watch?v=TErboGLHZGA
If you want to make a simple Java GUI music player using the NetBeans IDE, click here: https://www.youtube.com/watch?v=OX3CFHLV9ws
Here is a tutorial on how to record audio using Java: https://www.youtube.com/watch?v=WSyTrdjKeqQ
Link to the music used: https://www.youtube.com/watch?v=pzaoAe1zu5E
Thanks for watching this simple tutorial on how to play music using Java.
Subscribe to keep notified when I upload: https://tinyurl.com/SubMaxODidily
How to Play Music Using Java (Simple) ... https://www.youtube.com/watch?v=wJO_cq5XeSA
14906512 Bytes