一个 Python 脚本,利用 Spotify 的 Web API 和 OAuth 获取当前专辑封面,并作为旋转的黑胶唱片显示在 64x64 RGB LED 矩阵上。

Stars

148

7 天增长

暂无数据

Fork 数

18

开放 Issue

0

开源协议

暂无数据

最近更新

2026-06-30

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

将 Spotify 集成与物理 LED 矩阵显示结合,打造视觉上吸引人的实时音乐可视化工具,并且提供模拟模式以便无需硬件即可开发。

适合谁使用

  • 树莓派爱好者
  • 对 LED 矩阵项目感兴趣的开发者
  • 希望拥有实体音乐可视化器的 Spotify 用户
  • 制作音乐响应式显示的爱好者

典型使用场景

  • 在桌面或架子上进行个人音乐可视化
  • 反映当前播放内容的交互式艺术装置
  • 学习如何将 Spotify API 与硬件集成
  • 使用模拟输出快速原型化 LED 矩阵显示

项目优势

  • 使用 Spotify 官方 Web API(非仅浏览器 SDK),数据更可靠
  • 持久保存 OAuth 令牌,避免重复登录
  • 提供模拟输出模式,无需物理矩阵即可测试
  • 支持多种 LED 矩阵硬件映射(Adafruit HAT、常规)

使用前须知

  • 需要特定的 RGB 矩阵硬件和第三方项目的 Python 绑定
  • 在树莓派 Zero 上安装可能因内存不足而崩溃
  • 无头设置需要 SSH 端口转发以完成 OAuth 回调

README 快速开始

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

项目描述

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

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
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 与机器学习AI 智能体
2,390
slvDev
精选
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 与机器学习大语言模型
1,960
littledivy
精选
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 与机器学习
1,482