tnarla GitHub avatar

spotify-matrix

tnarla

A Python script that fetches current Spotify album art and displays it on a 64x64 RGB LED matrix as a spinning vinyl record, using Spotify's Web API and OAuth.

Stars

148

7-day growth

No data

Forks

18

Open issues

0

License

No data

Last updated

2026-06-30

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

Combines Spotify integration with a physical LED matrix display to create a visually appealing real-time music visualizer, and includes a mock mode for development without hardware.

Who it is for

  • Raspberry Pi enthusiasts
  • Developers interested in LED matrix projects
  • Spotify users wanting a physical music visualizer
  • Hobbyists building music-reactive displays

Use cases

  • Personal music visualization on a desk or shelf
  • Interactive art installations that reflect current playback
  • Learning to integrate Spotify API with hardware
  • Prototyping LED matrix displays using mock output

Strengths

  • Uses Spotify's Web API (not browser-only SDK) for reliable data
  • Persistent OAuth token storage avoiding repeated logins
  • Mock output mode for testing without physical matrix
  • Supports multiple LED matrix hardware mappings (Adafruit HAT, regular)

Considerations

  • Requires specific RGB matrix hardware and Python bindings from third-party project
  • Installation may crash on Raspberry Pi Zero due to low memory
  • Headless setup requires SSH port forwarding for OAuth callback

README quick start

Spotify Matrix

Shows the current Spotify album art on a 64x64 RGB matrix as a circular record. The album art is the record surface itself: it is cropped to a disk, spun while Spotify reports playback as active, and left stopped at the current angle when paused.

This uses Spotify's Web API currently-playing endpoint, not the browser-only Web Playback SDK. The first run opens Spotify OAuth, then the script stores a refresh token in .cache/spotify_token.json.

Files

  • spotify_matrix.py - Pi runtime script.
  • .env - local Spotify credentials, ignored by Git.
  • .env.example - template for recreating local config.
  • requirements.txt - Python dependencies, excluding the hardware-specific RGB matrix bindings.

Raspberry Pi setup

Install the RGB matrix Python bindings from the hzeller/rpi-rgb-led-matrix project for your HAT/wiring, then install this project's dependencies:

python3 -m venv .venv --system-site-packages
source .venv/bin/activate
pip install -r requirements.txt

The --system-site-packages flag is useful if the rgbmatrix bindings were installed system-wide.

This install sometimes crashes the raspberry pi zero, I had to do some fancy workarounds. Might be easier to use a pi with more memory!

Spotify setup

In the Spotify developer dashboard, make sure this redirect URI is allowlisted exactly:

http://127.0.0.1:8888/callback

For a headless Pi, forward the callback port from your computer:

ssh -L 8888:127.0.0.1:8888 pi@raspberrypi.local

Then run the script on the Pi and open the printed authorization URL in your local browser.

Run

This is the working command to run the script on your raspberry pi:

sudo -E .venv/bin/python spotify_matrix.py \
  --rows 64 \
  --cols 64 \
  --chain-length 1 \
  --parallel 1 \
  --gpio-slowdown 4 \
  --no-hardware-pulse \
  --hardware-mapping adafruit-hat

Useful hardware options:

sudo -E .venv/bin/python spotify_matrix.py \
  --hardware-mapping regular \
  --gpio-slowdown 2 \
  --brightness 65

For a non-Pi test that writes one PNG frame instead of using matrix hardware:

python spotify_matrix.py --mock-output /tmp/spotify-matrix-frame.png --once

To verify the album art is what spins on the disk, render four local preview frames:

python spotify_matrix.py --preview-frames /tmp/spotify-matrix-preview

Description

display your current listening on spotify on a 64x64 rbg matrix

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482