Skip to content

Heperowt/Java-CLI-Music-Player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CLI Music Player

A lightweight, interactive command-line audio player built using Java's native javax.sound.sampled API. This project demonstrates how to load, play, and control audio files directly from the terminal without needing any external graphical interface.

🎵 Supported Formats

Thanks to Java's built-in audio system, this program natively supports the following uncompressed audio formats:

  • .wav (WAVE format)
  • .au (Sun/NeXT audio format)
  • .aiff (Audio Interchange File Format)

(Note: Compressed formats like .mp3 or .ogg are not natively supported by standard Java libraries).

⚠️ Setup: Adding Your Audio File

Before running the code, you must provide the local path to your audio file inside the code.

  1. Open Main.java.
  2. Locate the following line in the main method: String filePath = ""; //COPY THE FILE PATH HERE
  3. Paste the absolute path to your .wav, .au, or .aiff file between the quotation marks.
    • Windows Example: "C:\\Users\\YourName\\Desktop\\song.wav" (Remember to use double backslashes)
    • Mac/Linux Example: "/Users/YourName/Desktop/song.wav"

🚀 Controls

Once the program is running, enter the following single-character commands in your terminal:

  • P -> Play the audio
  • S -> Stop / Pause the playback
  • R -> Reset / Rewind the audio back to the beginning
  • Q -> Quit the application

About

An interactive command-line audio player built with Java. Natively supports .wav, .au, and .aiff formats.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages