All-In-One Music Structure Analyzer for Apple Silicon (PyTorch/MPS)
Project description
all-in-one-mps
GPU-accelerated music structure analysis on Apple Silicon (PyTorch/MPS).
all-in-one-mps is an Apple Silicon-optimized port of the original All-In-One Music Structure Analyzer (upstream: mir-aidj/all-in-one). It runs end-to-end inference locally using PyTorch with Metal Performance Shaders (MPS), with an integrated pipeline designed for real songs (including demixing + spectrograms).
Given one or more audio tracks, it produces:
- Tempo (BPM)
- Beat times
- Downbeat times
- Section boundaries
- Section labels (intro / verse / chorus / bridge / outro, etc.)
Why this repo exists
The upstream project is a strong reference implementation, but macOS Apple Silicon users historically lacked a first-class GPU-accelerated inference path. This repository provides that acceleration via PyTorch MPS, with an emphasis on:
- High performance on M-series GPUs via Metal Performance Shaders
- Practical CLI defaults for song inference (demix -> spectrogram -> model -> outputs)
- Faithful behavior to the upstream model + method
I'm releasing all-in-one-mps alongside all-in-one-mlx (MLX acceleration) so Apple Silicon users can choose the stack that fits their environment.
Performance
Benchmark on a single file — Apple M4 Max, 128 GB RAM, macOS 26.3:
| Project | Time | vs upstream |
|---|---|---|
mir-aidj/all-in-one |
75.25s | baseline |
mir-aidj/all-in-one |
24.63s | ~3.1x faster (patched to use MPS) |
all-in-one-mps (this repo) |
13.43s | ~5.6x faster |
all-in-one-mlx |
5.96s | ~12.6x faster |
One run, one file — results will vary by hardware and content.
Related projects & attribution
| Project | Purpose |
|---|---|
mir-aidj/all-in-one |
Original reference implementation and training code |
all-in-one-mps |
This repo: PyTorch/MPS inference + packaging for Apple Silicon |
all-in-one-mlx |
Companion repo: MLX inference for Apple Silicon |
This repository began as a fork/port of the upstream project. The original method/model is described in:
- Taejun Kim & Juhan Nam, All-In-One Metrical and Functional Structure Analysis with Neighborhood Attentions on Demixed Audio (arXiv:2307.16425)
If you use this in academic work, please cite the paper and the upstream repository.
Requirements
| Component | Requirement |
|---|---|
| Hardware | Apple Silicon (M-series) |
| OS | macOS 13+ |
| Python | 3.10+ |
Need CUDA / Linux / Windows? Use the upstream project.
Installation
pip
pip install all-in-one-mps
uv (recommended)
uv pip install all-in-one-mps
Quickstart
Analyze one or more tracks:
allin1 path/to/song.wav
# or multiple:
allin1 path/to/a.wav path/to/b.wav
By default, results are written under:
./struct(set with--out-dir)
Common options
- Choose output directory:
allin1 song.wav --out-dir ./struct
- Save visualizations / sonifications:
allin1 song.wav --visualize --viz-dir ./viz
allin1 song.wav --sonify --sonif-dir ./sonif
- Keep intermediate byproducts (demixed audio + spectrograms):
allin1 song.wav --keep-byproducts
# demix files: ./demix (override with --demix-dir)
# specs: ./spec (override with --spec-dir)
- Overwrite specific stages (demix,spec,json,viz,sonify) or everything:
allin1 song.wav --overwrite all
allin1 song.wav --overwrite demix,spec,json
- Timing / performance instrumentation:
allin1 song.wav --timings-path timings.jsonl
allin1 song.wav --timings-path timings.jsonl --timings-viz-path timings.png
MPS inference controls
- Select model (pretrained name):
allin1 song.wav --model harmonix-all
- Select device:
allin1 song.wav --device mps # default when available
allin1 song.wav --device cpu # fallback
- Disable multiprocessing (debug / determinism / constrained envs):
allin1 song.wav --no-multiprocess
- Prefer standard
nattenbackend overnatten-mps:
NATTEN_MPS=0 allin1 song.wav
If natten is not installed, this build can still fall back to natten-mps.
Outputs
The CLI writes analysis artifacts under --out-dir (default ./struct). Each track produces a JSON file containing tempo, beats, downbeats, beat positions, and segment boundaries/labels.
Optional outputs:
| Artifact | Enable with |
|---|---|
| Visualizations | --visualize and --viz-dir |
| Sonifications | --sonify and --sonif-dir |
| Frame-level activations | --activ |
| Frame-level embeddings | --embed |
| JSONL timings | --timings-path |
Known limitations
- Artifact naming uses input basename/stem for intermediate and output files.
- If multiple inputs share the same basename (for example
a/song.mp3andb/song.wav), artifacts may overwrite each other or be reused unexpectedly. - Workaround: process those files separately or rename files so basenames are unique.
Python API
import allin1
result = allin1.analyze('song.wav')
# result.bpm, result.beats, result.downbeats, result.segments
results = allin1.analyze(['a.wav', 'b.wav'])
License
This project retains the upstream license (MIT). See LICENSE.
Issues
Please include:
| Include | Example |
|---|---|
| macOS version + Apple Silicon model | macOS 26.3, M4 Max |
| Python + PyTorch versions | Python 3.12.7, torch 2.x |
| Exact command and logs/traceback | Full allin1 ... command + stack trace |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file all_in_one_mps-1.0.0.tar.gz.
File metadata
- Download URL: all_in_one_mps-1.0.0.tar.gz
- Upload date:
- Size: 122.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d106e26a2e423707c3e6a2aa9de3fd918c57e0d419e1a81291f5dd317725d78d
|
|
| MD5 |
d9926f1a6199515d83eed8424006354d
|
|
| BLAKE2b-256 |
f01aeaf77a43c3e977014b36bf51959abc9be8f21d22340f07f8c3fa790fb003
|
Provenance
The following attestation bundles were made for all_in_one_mps-1.0.0.tar.gz:
Publisher:
release-pypi.yml on ssmall256/all-in-one-mps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
all_in_one_mps-1.0.0.tar.gz -
Subject digest:
d106e26a2e423707c3e6a2aa9de3fd918c57e0d419e1a81291f5dd317725d78d - Sigstore transparency entry: 1004423112
- Sigstore integration time:
-
Permalink:
ssmall256/all-in-one-mps@6bfb6d83510363dc7b8d841fed099bd8deb88ea6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ssmall256
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@6bfb6d83510363dc7b8d841fed099bd8deb88ea6 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file all_in_one_mps-1.0.0-py3-none-any.whl.
File metadata
- Download URL: all_in_one_mps-1.0.0-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156bb13a94ad422b2f5246f56830b5a3634f18b5d7662cdd199c82809ed9474f
|
|
| MD5 |
9f07570d10593435e75c843cf39c85b5
|
|
| BLAKE2b-256 |
e8841485f4532d8125e21998074099a8869e1e0feaa6ba905312313db67d5b39
|
Provenance
The following attestation bundles were made for all_in_one_mps-1.0.0-py3-none-any.whl:
Publisher:
release-pypi.yml on ssmall256/all-in-one-mps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
all_in_one_mps-1.0.0-py3-none-any.whl -
Subject digest:
156bb13a94ad422b2f5246f56830b5a3634f18b5d7662cdd199c82809ed9474f - Sigstore transparency entry: 1004423131
- Sigstore integration time:
-
Permalink:
ssmall256/all-in-one-mps@6bfb6d83510363dc7b8d841fed099bd8deb88ea6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ssmall256
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@6bfb6d83510363dc7b8d841fed099bd8deb88ea6 -
Trigger Event:
workflow_dispatch
-
Statement type: