Hey Spotify
No-interface, verbal Spotify controller using AppleScript and OpenAI Whisper
A tool designed to allow control of Spotify playback, volume, and shuffle using voice commands.
Overview
The idea originated from a small but recurring frustration of mine: adjusting Spotify’s volume while doing something that required my hands and screen. Changing system volume is easy, a volume knob on your keyboard, or buttons on your headset, but I didn’t have anything to change Spotify volume with other than the app.
This irked me a lot if I happened to be playing video games. Changing Spotify’s volume independently of the system volume required interrupting whatever I was doing, interacting with the application, and then going back. I wanted a way to control Spotify without having that interruption.
The idea was to create a small, voice-controlled interface that would let me manage Spotify playback through simple spoken commands. Something like an ultra-specialized Siri.
Approach
It’s a lightweight command-line application using Python and OpenAI Whisper for speech recognition, with AppleScript handling interactions with the Spotify desktop application.
The interaction revolves around a wake phrase: “Hey Spotify”. Once detected, the application listens for a command within a predefined time window, transcribes it using Whisper and matches it against a set of supported commands.
These included:
- Volume control: Increase or decrease volume in increments of 10% (by saying “Volume Up” or “Volume Down”), or specify an exact volume between 1 and 100 (“Volume…” followed by the desired number).
- Playback control: Pause, resume and skip tracks (“Pause”, “Resume”, “Skip”).
- Shuffle: Enable or disable Spotify’s shuffle functionality (“Shuffle On”, “Shuffle Off”).
Commands had some common alternatives too. After they were recognized, they were translated into corresponding AppleScript instructions and executed directly through the Spotify application.
Outcome
The result was a lightweight, voice-driven Spotify controller with virtually no graphical interface. The command-line application primarily served as a way to display what the app heard and transcribed, while the actual interaction happened entirely through speech.
I got to explore how voice interaction works and how tools like Whisper work. I also deliberately kept the functionality focused on the controls I actually needed. After all it was a small and isolated problem I wanted to solve.