Jarvis controls local MP3 playback through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Harsha200105/DesktopAssistant/llms.txt
Use this file to discover all available pages before exploring further.
pygame.mixer module (Windows version). You can start, pause, resume, and stop music entirely by voice, with no need to touch the keyboard. Playback picks a track at random from your music folder each time you say “play music”, so the experience stays varied across sessions.
The Ubuntu version (
Jarvis2.py) plays music using os.system() instead of pygame.mixer, and expects five tracks (music1 through music5). The Windows version (Jarvis2_4windows.py) uses pygame.mixer and expects four tracks (music1 through music4). This page documents the Windows implementation in commands.py.Prerequisites
Before the music commands work you must configure the path to your music folder inconfig.ini. The folder must contain MP3 files named music1.mp3, music2.mp3, music3.mp3, and music4.mp3.
Commands
Play music
Say “play music” to load and play a random track from your music folder.random.choice(music) picks one of the four track names, the folder path and .mp3 extension are concatenated, and mixer.music.load() + mixer.music.play() start playback. If anything goes wrong (file not found, bad path, corrupt MP3), Jarvis speaks the exception message aloud.
Pause music
Say “pause music” to pause the currently playing track without losing your position.Unpause
Say “unpause” to resume playback from where it was paused.Stop music
Say “stop music” to stop playback entirely. Unlike pause, stopping resets the track position — playing again will pick a new random track.“stop music” and “stop” are different commands. Saying just “stop” triggers
command_nothing(), which exits the entire program. Make sure to say the full phrase “stop music” when you only want to end playback.Music file naming convention
Thecommand_play_music() function looks for files using the tuple ("music1", "music2", "music3", "music4"). Your files must be named exactly:
mixer.music.load() will raise a FileNotFoundError and Jarvis will speak the error.