No description
  • JavaScript 55%
  • Python 30.7%
  • HTML 14.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-08 14:02:34 +02:00
.idea FIX: amd gpu 2025-11-27 20:51:06 +01:00
__pycache__ UPDATE 2026-05-08 14:02:34 +02:00
.gitignore .gitignore 2025-11-29 20:28:13 +01:00
back.py UPDATE 2026-05-08 14:02:34 +02:00
explorer.html UI: styling options 2025-11-29 20:27:22 +01:00
explorer.js UI: styling options 2025-11-29 20:27:22 +01:00
interface.png add screenshot 2025-11-26 20:01:39 -08:00
pyproject.toml TWEAK: Styling 2025-11-28 23:36:11 +01:00
README.md UPDATE 2026-05-08 14:02:34 +02:00
requirements.txt commit MVP 2025-11-26 19:58:48 -08:00
server.py UPDATE 2026-05-08 14:02:34 +02:00
uv.lock TWEAK: Styling 2025-11-28 23:36:11 +01:00

Latent Space Explorer

Interactive 3D visualization of audio latent spaces using Stable Audio VAE + UMAP.

screenshot of a big blob of multicolored dots and glow, representing a playable 3d projection of the latents from encoding a song with the stable audio VAE

Features

  • Encode audio to 64-dimensional latent vectors via Stable Audio VAE
  • UMAP projection to 3D for interactive visualization
  • Playback sync - click points to hear audio chunks, or play full song with animated playhead
  • Latent resynthesis - use one song's latents as a "codebook" to resynthesize another
  • K-means clustering with animated cluster regions
  • Rainbow line mode for temporal visualization

Quick Start

# Install dependencies
pip install -r requirements.txt

# Set model paths (or place files in current directory)
export VAE_CONFIG_PATH="path/to/stable_audio_2_0_vae.json"
export VAE_CKPT_PATH="path/to/sao_vae_tune_100k_unwrapped.ckpt" # or normal stable audio vae

# Run server
python server.py

Open http://localhost:8420 in your browser.

Environment Variables

Variable Default Description
VAE_CONFIG_PATH stable_audio_2_0_vae.json Path to VAE config JSON
VAE_CKPT_PATH sao_vae_tune_100k_unwrapped.ckpt Path to VAE checkpoint
PORT 8420 Server port

Getting the VAE Model

You need the Stable Audio VAE weights. Options:

  1. Official weights from Stability AI (requires license)
  2. Community fine-tunes from HuggingFace
  3. Train your own using stable-audio-tools

The server will run in mock mode (feature-based pseudo-latents) if the VAE fails to load.

Usage

  1. Upload audio - drag & drop or click "Upload Audio"
  2. Explore - drag to rotate, scroll to zoom, click points to hear chunks
  3. Play - press Space or click Play to animate through the song
  4. Resynth - click "🔀 Resynth" and upload a second audio file to resynthesize it using the first song's latents as a codebook
  5. Adjust K - use the slider to change number of cluster regions

Keyboard Shortcuts

Key Action
Space Play/Stop
← Seek back 5s
→ Seek forward 5s

How Resynthesis Works

Based on Latent Resynthesis:

  1. Source audio → encode → latents (your "codebook")
  2. Target audio → encode → for each latent, find nearest neighbor in codebook
  3. Replaced latents → decode → output

Result: target's structure + source's timbre.

API Endpoints

Endpoint Method Description
/encode_stream POST Upload audio, stream encoding progress via SSE
/audio_full GET Get full loaded audio as WAV
/play POST Get 2048-sample chunk by index
/resynth POST Resynthesize uploaded audio using current codebook
/health GET Server status

Tech Stack

  • Backend: FastAPI, PyTorch, torchaudio, UMAP
  • Frontend: Vanilla JS, Three.js (via CDN)
  • No build step - just run the server

Optimize sont length

But du jeu > Accéléré ou ralentir la musique pour que son BPM match l'une des valeurs suivantes: Dans ce cas, la découpe sera optimale

  1. Détection de beat > c'est pas fiable à 100% donc à voir. Peut-être fait à la main.
  2. Détection de la phase / de l'offset, qui doit se faire après la détection du beat.
nb découpe bpm
8 161.5
9 143.56
10 129.2
11 117.45
12 107.7
13 117.45
14 92.28
15 86.13

License

MIT