Voice‑Controlled Music: Managing Spotify and Apple Music Hands‑Free on macOS – In a world where multitasking is the norm, reaching for the mouse to pause a track or skip a song interrupts workflow and breaks concentration. macOS offers built‑in voice capabilities, but they stop short of deep integration with third‑party streaming services like Spotify. This guide shows how to bridge that gap, turning your Mac into a truly hands‑free jukebox. By the end, you will be able to launch, control, and script Spotify playback using only your voice, the Terminal, and the autonomous AI assistant Purple, which securely executes browser workflows, scrapes data, drafts documents, summarizes PDFs, and automates Finder tasks with BYOK (Bring‑Your‑Own‑Key) encryption.
1. Preparing macOS Voice Control and Accessibility Settings
Enable “Voice Control” in System Settings
macOS Ventura and later ship a robust Voice Control engine that replaces the older “Dictation” feature. Follow these steps to activate it:
- Open System Settings → Accessibility → Voice Control.
- Toggle the switch to On. macOS will download the language model (≈150 MB) the first time.
- In the Commands pane, click Customize… and ensure the “Play/Pause” and “Next Track” default commands are checked.
- Optionally, create custom phrases such as “Spotify blast” or “Apple Music groove” by clicking the + button and mapping them to the appropriate AppleScript (see Section 4).
Grant Accessibility Permissions to Terminal and Third‑Party Apps
Voice Control relies on the Accessibility API to send keystrokes to other applications. Open System Settings → Privacy & Security → Accessibility and add the following items:
- Terminal.app (for running scripts)
- Spotify.app (to receive simulated media keys)
- Safari or Chrome (if you plan to control Spotify Web Player)
- Purple.app (the AI assistant that will orchestrate voice‑to‑command pipelines)
2. Configuring Spotify for Seamless Voice Interaction
Install Spotify’s Command‑Line Interface (spicetify)
While Spotify does not expose a native CLI, the open‑source spicetify tool can manipulate playback via the Web API. Install it with Homebrew:
brew install spicetify-cli
After installation, run the initial setup to link your Spotify account:
spicetify config --user <your_spotify_username>
spicetify auth
The spicetify auth command opens a browser window where you log in and grant the required scopes (playlist‑read‑private, user‑modify‑playback‑state, etc.).
Expose Playback Controls via AppleScript
Spotify ships with a limited AppleScript dictionary, but you can extend it using spicetify. Create a script file ~/Scripts/spotifyControl.applescript with the following content:
on playPause()
tell application "Spotify"
if player state is playing then
pause
else
play
end if
end tell
end playPause
on nextTrack()
tell application "Spotify" to next track
end nextTrack
on previousTrack()
tell application "Spotify" to previous track
end previousTrack
on setVolume(vol)
tell application "Spotify" to set sound volume to vol
end setVolume
Save the file and make it executable from the command line:
chmod +x ~/Scripts/spotifyControl.applescript
Map Voice Phrases to the AppleScript Functions
Return to the Voice Control Commands pane, click Customize…, then Add Command. Use the following mappings:
- Phrase: “Spotify play” → Action:
Run AppleScript→ Script:~/Scripts/spotifyControl.applescript playPause - Phrase: “Spotify next” → Action:
Run AppleScript→ Script:~/Scripts/spotifyControl.applescript nextTrack - Phrase: “Spotify back” → Action:
Run AppleScript→ Script:~/Scripts/spotifyControl.applescript previousTrack - Phrase: “Spotify louder” → Action:
Run AppleScript→ Script:~/Scripts/spotifyControl.applescript setVolume 80
3. Leveraging Purple for Context‑Aware Voice Automation
What Purple Brings to the Table
Purple is a native, privacy‑first AI layer for macOS that listens for natural language, parses intent, and triggers secure workflows without exposing your data to external clouds. Its BYOK architecture encrypts all voice payloads locally before any optional remote processing, ensuring compliance with enterprise security policies.
Installing and Registering Purple
Download the signed installer from 1into1.com, then run:
sudo installer -pkg ~/Downloads/Purple.pkg -target /
During first launch, Purple will generate a local encryption key pair. Export the public key to your IT department if required for audit.
Creating a “Spotify Voice Hub” Workflow in Purple
Purple’s workflow editor uses a simple YAML DSL. Save the following as ~/PurpleWorkflows/spotifyHub.yaml:
name: Spotify Voice Hub
trigger: voice
intent:
- play spotify
- pause spotify
- next song
- previous song
- set spotify volume to <level>
actions:
- if: "{{intent}} == 'play spotify'"
then: "osascript -e 'tell application \"Spotify\" to play'"
- if: "{{intent}} == 'pause spotify'"
then: "osascript -e 'tell application \"Spotify\" to pause'"
- if: "{{intent}} == 'next song'"
then: "osascript -e 'tell application \"Spotify\" to next track'"
- if: "{{intent}} == 'previous song'"
then: "osascript -e 'tell application \"Spotify\" to previous track'"
- if: "{{intent}} matches 'set spotify volume to (\d+)'"
then: "osascript -e 'tell application \"Spotify\" to set sound volume to {{match[1]}}'"
security:
encryption: byok
audit: true
Load the workflow with Purple’s CLI:
purple workflow load ~/PurpleWorkflows/spotifyHub.yaml
From now on, saying “Play Spotify” or “Set Spotify volume to 60” will be interpreted by Purple, which then executes the corresponding AppleScript command securely.
Combining Apple Music and Spotify in a Single Voice Command
Purple can disambiguate based on context. Add the following snippet to the same YAML file:
- if: "{{intent}} == 'play music'"
then: |
if [[ $(osascript -e 'application \"Spotify\" is running') == true ]]; then
osascript -e 'tell application \"Spotify\" to pause'
fi
osascript -e 'tell application \"Music\" to play'
Now “Play music” will pause Spotify (if it’s active) and start Apple Music, giving you a seamless handoff between services.
4. Advanced Automation: Terminal, AppleScript, and Shortcuts Integration
One‑Liner Terminal Commands for Quick Testing
Before committing to voice, verify that the CLI can control playback:
# Toggle play/pause
osascript -e 'tell application "Spotify" to playpause'
# Skip to next track
osascript -e 'tell application "Spotify" to next track'
# Query current track info
osascript -e 'tell application "Spotify" to name of current track & " – " & artist of current track'
Embedding Commands in macOS Shortcuts
macOS Shortcuts can call shell scripts, allowing you to expose Spotify controls to the Touch Bar, menu bar, or even Siri. Create a new Shortcut named “Spotify Next” with the action Run Shell Script and paste:
osascript -e 'tell application "Spotify" to next track'
Assign a custom Siri phrase like “Next on Spotify” and the Shortcut will be invoked automatically.
Scheduling Playback with launchd
For background tasks—e.g., start a focus playlist at 9 AM—create a plist file at ~/Library/LaunchAgents/com.user.spotify‑morning.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>com.user.spotify-morning</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>-e</string>
<string>tell application "Spotify" to play track "spotify:track:5ChkMS8OtdzJeqyyb74wDg"</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key><integer>9</integer>
<key>Minute</key><integer>0</integer>
</dict>
<key>RunAtLoad</key><true/>
</dict>
</plist>
Load it with launchctl load ~/Library/LaunchAgents/com.user.spotify‑morning.plist. The track will start automatically, and you can still pause it later with a voice command.
5. Comparison: Native Siri vs. Purple vs. Third‑Party Voice Tools
| Feature | Native Siri (macOS) | Purple (BYOK AI) | Third‑Party (e.g., Voice Control + Keyboard Maestro) |
|---|---|---|---|
| Deep Spotify Integration | Limited – only basic “Play” via Apple Music bridge | Full – custom intents, volume, playlist selection | Variable – depends on macro scripts |
| Privacy Model | Apple servers process voice (opt‑out limited) | All audio encrypted locally; BYOK keys never leave device | Often cloud‑based transcription (higher risk) |
| Context Awareness | Simple command/response | Multi‑intent parsing, conditional logic | Static hotkeys only |
| Ease of Setup | Out‑of‑the‑box | One‑time install + workflow YAML | Requires multiple apps and linking |
| Extensibility | Limited to Apple ecosystem | Open DSL, can call any shell command | Depends on third‑party plugin ecosystem |
| Security Auditing | Apple internal logs | Built‑in audit trail, BYOK compliance | Usually none |
Pros of Purple – privacy‑first, scriptable, works across Spotify, Apple Music, and Finder tasks. Cons – requires initial learning curve with YAML and CLI.
Pros of Native Siri – zero‑setup, familiar UI. Cons – cannot control Spotify directly and sends raw audio to Apple’s cloud.
Pros of Third‑Party Macro Suites – visual editors, community templates. Cons – fragmented security, often rely on external services for voice recognition.
Frequently Asked Questions
Can I control Spotify on a Mac without installing any third‑party apps?
Only basic playback can be toggled via the media keys that macOS exposes to Siri. For full control—track skipping, volume, playlist selection—you need either a CLI tool like spicetify or an automation layer such as Purple.
Is my voice data sent to the cloud when using Purple?
No. Purple encrypts every audio snippet with a locally generated BYOK key before any optional remote processing. The encrypted payload never leaves your Mac unless you explicitly enable a cloud‑based model, which is disabled by default.
How do I make my custom voice commands work when Spotify is not the frontmost app?
Voice Control and Purple send AppleEvents directly to the Spotify process, bypassing the need for focus. Ensure Spotify has Accessibility permission (see Section 1) and that your AppleScript functions target the application by name, not by UI element.