Decentralized β’ AI-Native β’ Stem-Level Monetization
π§ Work in Progress β This is an experimental project under active development. Not production-ready.
Resonate is a decentralized music streaming protocol where artists monetize audio stems (vocals, drums, bass) as programmable IP, and users deploy AI agents to curate, remix, and negotiate usage rights in real-time.
- ποΈ Stem-Level IP β Artists upload stems as ERC-1155 NFTs with granular licensing
- π€ AI Agent Wallets β ERC-4337 smart accounts with autonomous micro-payment capabilities
- π³ x402 Payments β AI agents purchase stems via HTTP using USDC β no account required
- π° Transparent Royalties β On-chain payment splitting with real-time analytics
- π Remix Engine β Composable smart contracts for derivative works
graph TB
subgraph Frontend
Web[Next.js App]
end
subgraph Backend
API[NestJS API]
Worker[Demucs Worker]
Redis[(Redis Queue)]
PubSub[GCP Pub/Sub]
end
subgraph Blockchain
AA[ERC-4337 Accounts]
NFT[Stem NFTs]
Split[Payment Splitter]
end
subgraph Storage
DB[(PostgreSQL)]
IPFS[IPFS/GCS]
end
Web --> API
API --> DB
API --> Redis
API -->|stem-separate| PubSub
PubSub -->|pull| Worker
Worker -->|stem-results| PubSub
PubSub -->|pull| API
API --> AA
Worker --> IPFS
AA --> NFT
NFT --> Split
| Tool | Install |
|---|---|
| Node.js 18+ | nodejs.org or nvm install 18 |
| Docker | docker.com/get-started |
| Redis | Starts via Docker (port 6379) |
| Make | Pre-installed on macOS/Linux; Windows: use WSL |
| Foundry (for contract deployment) | getfoundry.sh |
Two AA modes are available β see AA Integration for architecture and Local AA Development for setup.
# 1. Set env vars
export SEPOLIA_RPC_URL=https://sepolia.drpc.org
# 2. Start infrastructure (Postgres, Redis, Pub/Sub emulator, Demucs worker)
make dev-up # use `make dev-up-build` after worker code changes
# check the container status summary β all should show β
make local-aa-fork # Forks Sepolia, configures .env (AA infra already on-chain)
make deploy-contracts # Configures .env with Sepolia contract addresses
# (contracts already exist on the fork β no new deployment)
# 3. Start services (separate terminals)
make backend-dev # NestJS API on port 3000
make web-dev-fork # Next.js on port 3001 (chainId 11155111, local RPC)Note: On a Sepolia fork,
make deploy-contractsdetects the fork and uses the existing Sepolia deployment addresses fromcontracts/deployments/sepolia.jsonβ no new contracts are deployed. For local-only mode (chain 31337), it deploys fresh contracts via Forge.
# 1. Deploy everything (Docker + Anvil + all contracts)
# This starts Postgres, Redis, Pub/Sub emulator, and Demucs worker
make dev-up
make contracts-deploy-local # Deploys AA + StemNFT + Marketplace + TransferValidator
# 2. Start services (separate terminals)
make backend-dev # NestJS API on port 3000
make web-dev-local # Next.js on port 3001 (chainId 31337)
# 3. (Optional) View Demucs worker logs
docker compose logs -f demucs-workermake db-reset # Reset database (requires Docker running)
make dev-down # Stop Docker containers
make local-aa-down # Stop Anvil + bundlerWhen an artist uploads a release, the following pipeline executes:
Upload β Validation β Pub/Sub β Stem Separation β Encryption β Storage β Ready
| Stage | Status | Description |
|---|---|---|
pending |
π΅ | Track queued for processing |
separating |
π‘ | Demucs AI splitting audio into 6 stems |
uploading |
π‘ | Uploading stems to IPFS/storage |
complete |
π’ | Ready for playback and minting |
failed |
π΄ | Processing error (check worker logs) |
Stems generated: vocals, drums, bass, guitar, piano, other
The release page displays track status in real-time, with stems appearing as they complete processing.
The Demucs worker uses Facebook's htdemucs_6s model to separate audio into 6 stems: vocals, drums, bass, guitar, piano, other.
GPU acceleration is enabled by default β
make dev-uplaunches the worker with NVIDIA GPU support viadocker-compose.gpu.yml.
Performance comparison:
| Hardware | 3-min song | Notes |
|---|---|---|
| CPU (8 cores) | ~10 min | Fallback if no GPU available |
| NVIDIA GPU (RTX 3080) | ~45 sec | 10-15x faster |
Model caching: The ~52MB htdemucs_6s model is pre-downloaded during Docker build.
# View worker logs
make worker-logs
# Check worker health
make worker-health
# Rebuild worker (after code changes)
make worker-rebuild
# Quick build (skip model pre-cache, downloads on first use)
make worker-quick-buildmake dev-up attempts GPU mode first. If the worker fails to start (no NVIDIA runtime), it automatically falls back to CPU mode β no manual intervention needed. CPU mode works but stem separation takes ~3min instead of ~30s.
To enable GPU acceleration:
- NVIDIA GPU with CUDA support
- NVIDIA Container Toolkit
π NVIDIA Container Toolkit Installation (Ubuntu/Debian/WSL2)
# Add NVIDIA package repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
# Install and configure
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
# Verify installation
docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smiVerify GPU in worker:
docker compose exec demucs-worker nvidia-smiTroubleshooting:
- Worker stays in "Created" state β Run
sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker nvidia-smifails β Reinstall NVIDIA Container Toolkit- WSL2 users β Use NVIDIA driver for WSL, not native Linux driver
- Build hangs on apt-get β Rebuild with
make worker-rebuild(fixed viaDEBIAN_FRONTEND=noninteractive)
See workers/demucs/README.md for full worker documentation.
| Symptom | Cause | Fix |
|---|---|---|
| Container shows "Created" (not "Up") | Port conflict β another container or process is using the port | Run docker ps to find the conflicting container, then docker stop <name> |
| Redis won't start (port 6379) | Stale Redis from another project | docker stop <old-redis-container> then make dev-up |
| Track stuck at "π‘ Separating..." | Demucs worker not running | Check make worker-health and docker compose ps demucs-worker |
| No progress % during separation | Worker can't POST progress back to backend | Verify BACKEND_URL=http://host.docker.internal:3000 in backend/.env |
SEPOLIA_RPC_URL warning in Docker logs |
Env var not exported in current shell | Run export SEPOLIA_RPC_URL=https://sepolia.drpc.org before make dev-up |
| Document | Description |
|---|---|
| Project Specification | Vision, architecture, and roadmap |
| Deployment Guide | Infrastructure, storage, and environment setup |
| Local AA Development | Account abstraction setup guide |
| Demucs Worker | GPU stem separation setup and troubleshooting |
| Core Contracts | Stem NFT and marketplace contracts |
| Marketplace Integration | Frontend/backend integration |
| x402 Payments | Machine-to-machine stem purchases via x402 |
| Contributing | Contribution guidelines |
| Layer | Technology |
|---|---|
| Frontend | Next.js 15, TanStack Query, Viem/Wagmi |
| Backend | NestJS, Prisma, BullMQ, GCP Pub/Sub, PostgreSQL |
| Blockchain | Solidity, Foundry, ERC-4337, ZeroDev |
| AI | Demucs (htdemucs_6s), Vertex AI |
| Infrastructure | Docker, Redis, GCP Pub/Sub, GitHub Actions |
MIT Β© 2024-2026