SoundFlex is a lightweight command-line audio player built using Python and Pygame. It allows you to play, pause, unpause, stop, and adjust the volume of your audio files through simple commands. This tool was created for fun and is ideal for quick audio playback from the terminal. Actually, I guess, I was feeling some kind of boredom, so I began to create this project :)
- Play: Start playing an audio file.
- Pause: Pause the currently playing audio.
- Unpause: Resume playback of the paused audio.
- Stop: Stop the audio playback.
- Volume Control: Adjust the volume of the audio.
- Basic Functionality: Allows you to load, play, pause, unpause, and stop audio files.
- Volume Control: Set volume levels directly, with checks for valid input ranges.
- Error Handling: Basic error handling for file operations and commands.
- Audio File Listing: Added functionality to list all audio files in the current directory, making it easier to find and select files.
- Volume Input Range: Adjusted volume input to accept values between 0 and 100 (converted to a range of 0.0 to 1.0 internally).
- Enhanced User Experience: Updated command options and improved error handling for volume and file operations.
- Interactive File Selection: Instead of typing the exact filename, users can now select an audio file by choosing its corresponding number from a list of available files. This feature enhances usability by reducing input errors and speeding up the selection process.
- Improved Error Messages: The application provides more informative error messages when users enter invalid input for file selection, helping users correct their mistakes more easily.
- Flexible Quit Command: The quit command is now more flexible, accepting variations like "quit" or "QUIT" to exit the program, improving the user experience by making commands more forgiving.
- Enhanced Command Handling: Refined command parsing logic for better error handling and user feedback when commands are entered incorrectly.
- Code Quality Enhancements: Improved code comments and formatting for better readability and maintenance, ensuring that the codebase is easier to understand and modify.
-
Clone the repository:
git clone https://github.com/bilalahmadkhankhattak/soundflex.git cd soundflex
-
Install the required dependencies:
pip install -r requirements.txt
Ensure you have Python 3.x installed and the following Python packages:
pygame
colorama
You can install them manually if needed:
pip install pygame colorama
-
Copy Your Audio Files:
- Place the audio files you want to play in the same directory.
-
Run the program:
python3 SoundFlex.py
-
Enter the exact name of the audio file:
- Example:
example.mp3
- Example:
-
Use the following commands:
- play: Play the audio file.
- pause: Pause the playback.
- unpause: Resume playback after pausing.
- stop: Stop the playback.
- volume [level]: Adjust the volume level (e.g.,
volume 0.5
). - quit: Exit the program.
-
Example Session:
Enter the exact name of the audio file (e.g., example.mp3): youraudiofile.mp3 Loaded youraudiofile.mp3 Playing... Commands: play, pause, unpause, stop, quit Enter Command: pause Paused Enter Command: volume 0.7 Volume Set To 70% Enter Command: quit
This project is licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. You may use, modify, and distribute this code for non-commercial purposes with appropriate credit. Commercial use is prohibited.
Made by Bilal Ahmad Khan Khattak (also known as Bilred).
- The program may require you to have the necessary audio drivers installed on your system to function correctly.
- This tool is for personal and educational purposes only. Please respect copyright laws when using audio files.
Enjoy using SoundFlex!