fractal-dj
Local OpenClaw skill that bridges FractalDJ on the R1 to the Spotify API, Chaotica/JWildfire fractal rendering, and the local-renderer pipeline. Polls current playback for BPM, key, energy, valence, and loudness, then streams those parameters back to the R1 so the fractal canvas updates live to the music. Also accepts high-res capture requests and saves them to disk.
- License 许可
- MIT
- 最近更新
- 2026-09-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- fractal-dj
- author
- rabbit-r1-skillz
- version
- 1.0.0
- description
- Local OpenClaw skill that bridges FractalDJ on the R1 to the Spotify API, Chaotica/JWildfire fractal rendering, and the local-renderer pipeline. Polls current playback for BPM, key, energy, valence, and loudness, then streams those parameters back to the R1 so the fractal canvas updates live to the music. Also accepts high-res capture requests and saves them to disk.
02 资源文件 3
- 资产文件card.jpg27.2 KB
- 资产文件icon.png10.5 KB
- 参考文档index.html53.1 KB
03 SKILL.md 正文
FractalDJ — OpenClaw Skill
FractalDJ syncs real-time Spotify audio features to fractal flame animations on the R1 display. This skill runs on your local machine and handles:
- Polling the Spotify Web API for current track features (BPM, key, energy, valence, loudness)
- Forwarding those features to the R1 on each poll cycle
- Receiving high-res capture requests from the R1 and invoking a fractal rendering engine
- (Optional) Bridging to the local-renderer pipeline for locally-generated parallels
Commands handled
| R1 sends | Skill handles |
|---|---|
fractal-dj / now_playing |
Returns current Spotify track + audio features |
fractal-dj / capture_frame |
Renders a high-res fractal PNG from the current params |
local-renderer / generate (type: fractal) |
Handled by local-renderer (separate skill) |
Prerequisites
1. Node.js v18+
node --version # must print v18.x.x or higher
2. OpenClaw daemon
npm install -g openclaw
openclaw start
OpenClaw must be running before launching the R1 app. It polls the R1's shared
storage key openclaw:cmd and dispatches to registered skills.
3. Spotify Developer App
FractalDJ uses the Spotify Web API. You need a free developer app:
- Go to https://developer.spotify.com/dashboard and log in.
- Click Create App.
- Set Redirect URI to
http://localhost:8888/callback. - Copy your Client ID and Client Secret.
The skill handles the OAuth2 PKCE flow automatically on first run. You will be prompted to authorize in a browser once.
4. Fractal rendering engine (for high-res capture)
High-res capture (long-press PTT) sends fractal parameters to a local rendering engine. Choose one:
Option A: Chaotica (recommended, free tier available)
Download from https://chaoticafractals.com/ and install. Note the path to the binary:
| OS | Default path |
|---|---|
| macOS | /Applications/Chaotica.app/Contents/MacOS/Chaotica |
| Windows | C:\Program Files\Chaotica\Chaotica.exe |
| Linux | /usr/local/bin/chaotica |
Chaotica renders a flame XML file to PNG:
chaotica --render flame.xml --output fractal.png --width 3840 --height 2160
Option B: JWildfire (free, Java-based)
Download from https://jwildfire.overwhale.com/ and install Java 11+ first.
java -jar JWildfire.jar --headless --render script.jwf --output fractal.png
5. local-renderer (optional — for parallel locally-rendered fractals)
Double-tap PTT on the R1 triggers local-renderer to generate a fractal from
the song title and mood alone. This requires a fractal rendering application that
can accept parameters via OpenClaw and return an image. Install any fractal
rendering software that supports headless/scripted operation (e.g., Chaotica,
JWildfire, or a custom renderer), register it as a separate OpenClaw skill named
local-renderer, and ensure it handles the generate command with a type: fractal payload. See the rendering software's own documentation for setup.
Installation
# Copy the skill into your OpenClaw skills directory
cp -r fractal-dj ~/.openclaw/skills/fractal-dj
# Install Node dependencies
cd ~/.openclaw/skills/fractal-dj
npm install
# Register the skill
openclaw skill register ./skill.json
skill.json:
{
"name": "fractal-dj",
"version": "1.0.0",
"entry": "index.js",
"commands": ["now_playing", "capture_frame"]
}
Configuration
Create ~/.openclaw/skills/fractal-dj/config.json:
{
"spotify": {
"clientId": "YOUR_SPOTIFY_CLIENT_ID",
"clientSecret": "YOUR_SPOTIFY_CLIENT_SECRET",
"redirectUri": "http://localhost:8888/callback",
"scopes": [
"user-read-currently-playing",
"user-read-playback-state"
]
},
"rendering": {
"engine": "chaotica",
"enginePath": "/Applications/Chaotica.app/Contents/MacOS/Chaotica",
"outputDir": "~/fractals",
"width": 3840,
"height": 2160,
"quality": "high"
},
"polling": {
"audioFeaturesCache": true,
"cacheTtlMs": 30000
}
}
Supported values for engine: "chaotica" or "jwildfire".
How the skill works
now_playing command
- R1 sends
{ skill: "fractal-dj", command: "now_playing" }every ~4 beats. - Skill calls
GET /me/player/currently-playingfrom the Spotify Web API. - If a track is playing, it fetches audio features (
GET /audio-features/{id}). Audio features are cached for 30s — Spotify rate limits this endpoint. - Skill maps Spotify's raw data to the R1 format:
| Spotify field | R1 field | Notes |
|---|---|---|
tempo |
bpm |
Beats per minute, float |
key (0–11) |
key |
Pitch class integer |
mode (0=minor, 1=major) |
mode |
0 or 1 |
energy (0–1) |
energy |
Spectral energy |
valence (0–1) |
valence |
Musical positiveness |
loudness (dB, usually -60–0) |
loudnessDb |
Integrated loudness |
item.name |
title |
Track title |
item.artists[0].name |
artist |
Primary artist |
is_playing |
isPlaying |
Playback state |
- Skill writes the response to
openclaw:respin R1 shared storage. - R1 reads the response and updates fractal params.
capture_frame command
- R1 sends current fractal parameters (speed, hueBase, hueSweep, density, symmetry, scale, palette hex array, t-value) and an output path.
- Skill converts params to a Chaotica-compatible flame XML:
palettehex colors → gradient stopssymmetry(2–7) → rotational symmetry fold countdensity→ iteration count (low: 1M, high: 50M)hueBase+hueSweep→ color gradient rotation
- Skill invokes the rendering engine with the generated XML.
- Output PNG is saved to
outputDir(default~/fractals/). - Skill writes
{ status: "done", data: { outputPath, renderTimeMs } }toopenclaw:resp. - R1 announces completion and saves the frame to its favorites.
Parameter → Fractal mapping (reference)
| Music param | Fractal effect |
|---|---|
| BPM | Animation speed (120 BPM = 1.0×; higher = faster) |
| Musical key | Hue base of the color gradient (12 positions, evenly spaced) |
| Mode (major/minor) | Major = warm palette; minor = cool/dark palette |
| Energy (0–1) | Fractal flame density and transform complexity |
| Valence (0–1) | Rotational symmetry order (high=symmetric, low=chaotic) |
| Loudness (dB) | Scale/zoom factor (louder = larger fill) |
Output files
Rendered fractals are saved to ~/fractals/ (configurable):
~/fractals/fractaldj_k2x8ab.png
~/fractals/fractaldj_k3z9cd.png
File names use a compact base-36 timestamp. Metadata (song title, artist, BPM,
fractal params) is written as PNG metadata (tEXt chunks) so images are
self-documenting.
Troubleshooting
| Symptom | Fix |
|---|---|
| R1 shows "OFFLINE" pill | Run openclaw start on your local machine |
| Spotify returns 401 Unauthorized | Delete ~/.openclaw/skills/fractal-dj/token.json and re-authorize |
| Spotify returns 429 Too Many Requests | Reduce poll frequency; audio features are already cached 30s |
| "Render timed out" on R1 | Confirm engine path in config.json; launch the engine GUI once to accept license |
| High-res PNG is blank | Engine license not accepted — open Chaotica/JWildfire manually first |
| Double-tap for local renderer does nothing | local-renderer skill must be separately registered and running |
| BPM jumps erratically | Spotify's BPM detection is imperfect for some genres; SUBTLE sensitivity mode helps |
| Fractal looks wrong on key change | Audio features are only fetched once per track; BPM drift within a track is not detected |
Spotify rate limits
The Spotify Web API enforces rate limits (HTTP 429). This skill handles them:
now_playingendpoint: polled at ~4-beat intervals (1.5–6s). Well within limits.audio-featuresendpoint: fetched once per track, cached. One call per song change.- On 429 response: exponential backoff starting at 2s, max 30s. R1 continues animating from cached params during backoff.
Security
This skill:
- Uses standard Spotify OAuth2 (authorization code flow). Tokens stored locally in
~/.openclaw/skills/fractal-dj/token.json. Refresh tokens are encrypted at rest using the system keychain where available (macOS Keychain, Windows Credential Manager). - Never transmits audio data — only metadata and audio features from Spotify's API.
- Reads fractal parameters from local OpenClaw shared storage only.
- Does not transmit image data off your machine. High-res frames are saved locally.
- Does not accept or execute arbitrary user-supplied code — flame XML is generated from structured parameters, not raw user input.
- The Chaotica/JWildfire executable is invoked with fixed arguments. No shell interpolation of user-supplied strings.
Local-only analysis (no Spotify)
If you use a local music player (not Spotify), the skill can optionally fall back to local audio analysis:
{
"audioSource": "local",
"localAnalysis": {
"enabled": true,
"method": "essentia"
}
}
Requires Essentia installed locally. Essentia performs real-time BPM, key, and loudness detection on the system audio output. This is an advanced configuration — Spotify mode is recommended for most users.
04 同仓库更多 Skills
whisper-quiz
WhisperQuiz — voice-answered trivia game for Rabbit R1. Generates questions via the R1's built-in LLM, captures spoken answers via STT, and evaluates correctness with flexible LLM-based matching.
walk-cast
Walking podcast production skill. Receives raw audio metadata and transcript from the R1, removes long pauses, applies noise reduction and normalization, generates AI chapter titles and episode metadata via LLM, and uploads the final episode to your configured podcast RSS host (Spotify for Podcasters / Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).
voice-novel
Local machine skill for VoiceNovel — handles story export to disk.
voice-guide
Environment description and navigation assistant for blind and low-vision users. Analyzes camera frames via a vision LLM, reads visible text, identifies scene categories (people/vehicles/food/hazards/exits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.
voice-draft
Voice-driven document drafting for the Rabbit R1. Dictate stream-of-consciousness speech; the R1 formats it into Email, Blog Post, Report, Proposal, Meeting Notes, Creative Writing, Code Comments, Cover Letter, or Tweet Thread — then saves the result to a configured folder on your local machine via OpenClaw.
voice-commit
Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git/CI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.