# AudioGhost AI π΅π»

π§ **[Hear it before you install: audioghost.suixu.ai](https://audioghost.suixu.ai/?ref=github-readme)**. Three real recordings play before and after separation, in your browser. No NVIDIA graphics card? Join the waitlist there for **AudioGhost Cloud**, which runs in the browser.

Type a sound, separate it, take it out of the mix. A CC0 cafΓ© recording, Base model, on an RTX 4090.
**Pull any sound out of audio or video**
Describe the sounds you want (vocals, a dog barking, traffic) and AudioGhost puts each one on its own track. Mix the tracks and export exactly what you hear, or your video with the new soundtrack. Powered by Meta's [SAM-Audio](https://github.com/facebookresearch/sam-audio), running locally on your own GPU, with no account to create.
  
## π What's new in v1.4
| | |
|---|---|
| βοΈ **Select a part** | Drag on a track to select a part: play it, loop it, **change the mix there only** (remove the siren between 0:10 and 0:15 and nothing else), or **separate only that part**, which is quick on a long file and leaves the rest of the recording untouched |
| π² **Takes and seeds** | *Try again* keeps the result you had. Step through the takes of a sound and keep the best one; every take shows its seed, and a seed repeats a result |
| ποΈ **Projects stay** | Your files, tracks and takes stay until you delete them (they used to be deleted after 24 hours), with their size on the start screen |
| π **Batch** | Happy with one file? Run the same sounds and mix on many files and download every result, one by one or in one ZIP |
| π§ **An editor's timeline** | Drag the ruler to move the playhead, resize the video and the panel, undo with Ctrl+Z, press ? for the shortcuts |
| π **Everything else, again** | Rebuild *Everything else* in another order (the sound removed first comes out cleanest) and switch between the versions |
v1.3: no Hugging Face account, smaller downloads, a Windows desktop app
| | |
|---|---|
| π **No Hugging Face account** | The models download from AudioGhost's own copies ([audioghostai](https://huggingface.co/audioghostai)) the first time you use them: no access request, no waiting for Meta's approval, no token ([how it works](#first-run-accept-the-model-license)) |
| π¦ **Smaller downloads, same results** | Small 1.4 GB instead of 5.1 GB, Large 6.3 GB instead of 14.9 GB, and they load into the same weights as Meta's checkpoints, bit for bit |
| π₯οΈ **Windows desktop app (beta)** | One installer: no conda, Redis or git, and it keeps itself up to date ([download](#windows-desktop-app-beta)) |
v1.2: several sounds per run, a mixer, export what you hear
| | |
|---|---|
| πΌ **Several sounds, one run** | Type `speech`, `background music`, `drums`... and each sound lands on its own track. An **Everything else** track holds what is left |
| ποΈ **A mixer** | Volume, mute and solo per track, plus *hold to hear the original*. Everything you hear is SAM-Audio's own output: mute one track and you get the model's own mix without that sound |
| πΎ **Export what you hear** | One mixed file, single tracks as a ZIP, or your video with the new soundtrack: 24-bit WAV, FLAC or MP3, named like `song [no vocals].wav` |
| π **Mark where a sound is, or isn't** | Drag on the timeline: *Sound is here* or *Not here*, per sound |
| π **Nothing gets lost** | Sessions survive page reloads and restarts; recent work stays one click away |
| π§ **A new interface** | One workspace instead of a long form, system status in the top bar, dark and light themes, keyboard friendly ([screenshots](#-demo)) |
| π **Everything else, made by the model** | Each new sound is removed from what the earlier ones left, so *Everything else* is real model output that still sounds like your recording (24 s stereo cafΓ© recording: 9 s for the first sound, 14 s for each one after it; Large, Balanced, RTX 4090) |
v1.1 made separation 4β6Γ faster, fixed the installers and added macOS & Linux. Full list in the [CHANGELOG](CHANGELOG.md).
## π¬ Demo
https://github.com/user-attachments/assets/4dd5dc31-f28e-4f7f-924c-d3eeac3f7f7d
A real field recording ("New Orleans ambience" by cognito perceptu, CC0). AudioGhost finds the band, plays just the band, then takes it out. Turn the sound on.

Start screen

## Features
- π― **Text-guided separation** - describe any sound: "vocals", "drums", "a dog barking", "crowd noise"
- πΌ **Multi-track** - several sounds per run, each on its own track, plus everything else
- ποΈ **Mixer** - *Remove* a sound, hear *Only* it, or set how much of it stays, for the whole file or for a selected part; *hold to hear the original*; all tracks play in sync
- βοΈ **Parts** - select a part of the timeline to play or loop it, change the mix there only, or separate only that part
- π² **Takes** - try a sound again, keep every take and pick the best; seeds make a result repeatable
- π **Batch** - run one project's sounds and mix on many files
- π¬ **Video** - preview the video with your mix and export it with the new soundtrack
- π **Hints** - mark where a sound is (or isn't) audible to point the model at the right source
- π **Consumer GPUs** - Small runs in ~4.2 GB of VRAM; long files are processed in crossfaded chunks
- β‘ **Speed / Quality presets** - Fast (8 steps), Balanced (16, Meta's default), High (32)
- π§ **Stereo** - per-channel separation that keeps the stereo image (on by default for stereo files)
- πΎ **Exports** - 24-bit WAV, FLAC, MP3 or a ZIP of single tracks, with readable names
- π **Projects** - your work survives reloads and restarts, and stays until you delete it
- π **No account** - the models download on first use, no Hugging Face login
## β‘ Performance
4:26 stereo song (`"singing voice"`), RTX 4090 (24 GB), Windows 11, 25 s chunks, Balanced quality.
"v1.0" is v1.0's inference path run on the same machine with the same weights.
| Model | v1.0 | **v1.1** | v1.1 Fast | v1.1 Stereo | Peak VRAM v1.1 (auto batch / low-VRAM) |
|---|---|---|---|---|---|
| Small | 95 s | **17 s** (16Γ realtime) | 14 s | 31 s | 6.3 GB / 4.2 GB |
| Base | 104 s | **20 s** (14Γ realtime) | 15 s | 39 s | 7.5 GB / 5.4 GB |
| Large | 120 s | **30 s** (9Γ realtime) | 20 s | 60 s | 11.0 GB / 8.9 GB |
- The batch size is chosen from free VRAM; on smaller GPUs AudioGhost automatically runs one chunk at a time and decodes one clip at a time ("low-VRAM" column: ~3Γ slower than the auto batch, still faster than v1.0). Shorter chunks need even less memory.
- Loading a downloaded model is disk-bound: a few seconds from a fast SSD with a warm cache, longer from a slow disk.
- First use of a model also downloads it: Small 1.4 GB, Base 2.7 GB, Large 6.3 GB, plus the 0.9 GB text encoder once (Meta's original checkpoints are 5.1, 7.7 and 14.9 GB). v1.0 additionally downloaded ~25 GB of ImageBind (4.8 GB), CLAP (1.9 GB), SAM-Audio-Judge (12.3 GB) and PE-A-Frame (5.8 GB) weights it never used.
- Reproduce on your machine: `python scripts/benchmark.py --file song.mp3 --model base`.
What changed under the hood (v1.0 β v1.1)
| | v1.0 | v1.1 |
|---|---|---|
| Model loading | `from_pretrained()` builds every sub-model (vision encoder, ImageBind, CLAP, Judge, span predictor), then deletes them | Builds only what text prompting uses, skips random init, memory-maps the checkpoint |
| Audio codec | cuDNN disabled by SAM-Audio β slow fallback convolutions and a per-timestep LSTM loop | Same computation with cuDNN (falls back automatically if cuDNN rejects a shape) |
| Precision | Whole model bf16, wrapped in fp16 `autocast` (so "float32" mode wasn't fp32 either) | fp16 transformer; T5, codec, RoPE and the ODE state in fp32 |
| Chunking | Hard cuts every 25 s, tail < 1 s dropped, one chunk at a time | Equal chunks, 2 s crossfades, shared noise, batched |
## Requirements
- **Windows 10/11** or **Linux (x86_64)** with an **NVIDIA GPU**, or a **Mac with Apple Silicon** (CPU only for now, so expect minutes rather than seconds; Intel Macs are not supported by PyTorch 2.9)
- **NVIDIA GPU**: 6 GB+ for Small, 8 GB+ for Base, 12 GB+ for Large (measured peaks: 4.2 / 5.4 / 8.9 GB with 25 s chunks; shorter chunks need less)
- **Anaconda / Miniconda**, **Node.js 18+** and **git** (not needed for the Windows desktop app)
- **No Hugging Face account**: the models download from AudioGhost's own copies the first time you use them. An account with access to Meta's repos is only needed for the optional `-tv` precision checkpoints.
> π‘ PyTorch, FFmpeg and Redis are installed by the installers. RTX 50-series cards get the CUDA 12.8 build automatically.
## π One-Click Installation (Recommended)
### Windows desktop app (beta)
The easiest way on Windows: **[download the installer](https://github.com/0x0funky/audioghost-ai/releases/latest)** (`AudioGhost__x64-setup.exe`, about 18 MB) and run it. On first start it sets up what it needs (Python, PyTorch, FFmpeg and SAM-Audio, about 6 GB) with no conda, Redis or git, and later it tells you when an update is out.
- Windows 10/11 (64-bit), about 10 GB of free space, an NVIDIA GPU (it runs on the CPU too, very slowly)
- The installer isn't code-signed yet, so Windows may say *Windows protected your PC*: click **More info**, then **Run anyway**. The release notes list each installer's SHA-256.
- Already installed AudioGhost with `install.bat`? The app offers to use that environment instead of downloading another one.
### Windows
```bash
# First time: creates the 'audioghost' conda env, installs everything (pinned), downloads Redis and FFmpeg
install.bat
# Every day
start.bat # starts Redis, API, worker and the web UI, then opens http://localhost:3000
stop.bat # stops only AudioGhost's own windows
```
### macOS (Apple Silicon) / Linux (x86_64)
```bash
./install.sh # conda env, PyTorch (CUDA build on Linux with an NVIDIA GPU), FFmpeg 7, Redis via Homebrew/apt
./start.sh # starts Redis, API, worker and web UI in the background (logs in ./logs), opens the browser
./stop.sh # stops exactly what start.sh started
```
On a Mac, SAM-Audio runs on the CPU: fine for short clips, slow for whole songs. The Apple GPU path can be tried with `AUDIOGHOST_DEVICE=mps ./start.sh` (experimental).
Updating an existing install: `git pull`, then run the installer again (it re-applies the version pins).
## First run: accept the model license
The first time, AudioGhost shows Meta's **SAM License**, which comes with the SAM-Audio weights. Accept it once, with the start screen's *Review* button or when you first press *Separate*. The model then downloads on first use:
| | Small | Base | Large |
|---|---|---|---|
| NVIDIA GPU (fp16) | 1.4 GB | 2.7 GB | 6.3 GB |
| Mac or CPU (fp32) | 2.4 GB | 5.0 GB | 12.2 GB |
The 0.9 GB text encoder is downloaded once for all sizes. Models are stored in the Hugging Face cache; to put them on another drive, see [Not enough disk space](#not-enough-disk-space-for-the-models).
The models come from [audioghostai](https://huggingface.co/audioghostai), AudioGhost's copies of Meta's weights:
- **What changed:** each size comes as an fp16 file (the default on NVIDIA GPUs; it loads into exactly the values AudioGhost used before) and an fp32 file (Macs, CPUs and *Full FP32*). The vision encoder, which only visual prompting needs, is left out, and the files are safetensors. `model_hub/` builds and publishes them.
- **Meta's own checkpoints:** if they are already in your Hugging Face cache, AudioGhost uses them as they are.
- **The `-tv` precision checkpoints:** these are still Meta's only. Use *Connect* on the start screen with a Read token from an account that has access.
## Usage
1. **Upload** an audio or video file (drag & drop or *Choose a file*). It becomes a project under **Projects**, and stays there until you delete it.
2. **Type the sounds you want**, in English, one at a time (Enter), or pick a suggestion: "speech", "vocals", "background music", "a dog barking", "traffic"... Each becomes its own track.
3. Optional:
- **Only a part**: drag on a track to select a part of the file, then choose *Selected part* in the panel. Good for trying a description on a long file first
- **Mark where a sound is**: click *Mark where it is* under the sound, then drag across the timeline with *It is here* or *Not here*. It's a hint for short, separate sounds; the whole file is still processed
- **Model** and **Quality**: Small / Fast for drafts, Large / High for final exports
- **Advanced**: stereo (on for stereo files; off is about twice as fast but mono), Meta's precision (`-tv`) checkpoints (need a Hugging Face account), full FP32, max chunk length
4. Click **Separate**. Tracks appear as they finish, so you can listen to one while the next is running. Cancel a track with its β. Not happy with one? Its β³ button makes another take and keeps the one you had.
5. **Mix**: *Only*, *Remove* and a level slider per track, *Hold to hear the original* to compare, Space to play and pause. Select a part first and the change applies there only. What you hear is always model output, picked by what you changed: everything at 100% plays the original; one track changed plays the model's own "without that sound" plus the track at your level; more changes play **Everything else** (the model removes each sound in turn from what the previous ones left) plus every track. Removing a finished track puts its sound back into Everything else.
6. **Export** what you hear as one file, single tracks as a ZIP, or (for videos) the video with your mix.
7. More files like this one? **Batch...** runs the same sounds and mix on them.
Press **?** in the workspace for the keyboard shortcuts.
### Command line
```bash
python sam_audio_lite.py song.mp3 "singing voice" --accept-license # the first time: accepts Meta's SAM License
python sam_audio_lite.py interview.mp4 "background music" --model base --quality fast -o out/
python sam_audio_lite.py live.flac "crowd noise" --stereo --start 12.5 --end 16 --format flac
```
## Manual Setup (Advanced)
Step by step, without the installers
### 1. Start Redis
`install.bat` downloads Redis to `redis/`. With Docker instead:
```bash
docker-compose up -d
```
### 2. Create the environment
```bash
conda create -n audioghost python=3.11 -y
conda activate audioghost
```
### 3. Install PyTorch 2.9
```bash
# RTX 20/30/40-series (CUDA 12.6)
pip install torch==2.9.0+cu126 torchvision==0.24.0+cu126 torchaudio==2.9.0+cu126 --index-url https://download.pytorch.org/whl/cu126 --extra-index-url https://pypi.org/simple
# RTX 50-series: replace cu126 with cu128 (all three packages and the index URL)
```
### 4. Install FFmpeg (required by TorchCodec)
**Windows:** download an FFmpeg 8 *shared* build - e.g. [`ffmpeg-n8.1-latest-win64-lgpl-shared-8.1.zip`](https://github.com/BtbN/FFmpeg-Builds/releases/tag/latest) - unzip it and add its `bin` folder to `PATH` (this is what `install.bat` does). Avoid conda-forge's FFmpeg on Windows for now: its packages currently ship two different `intl-8.dll` files, which breaks loading ([#10](https://github.com/0x0funky/audioghost-ai/issues/10)).
**macOS / Linux:**
```bash
conda install -c conda-forge "ffmpeg=7" -y
```
### 5. Install SAM-Audio (pinned)
```bash
pip install -c backend/constraints.txt "git+https://github.com/facebookresearch/sam-audio.git@bb4c6999d2677c7402360e426afc01ddfad6dce0"
```
`backend/constraints.txt` keeps torch, torchcodec and xformers on the tested versions - without it pip may swap your CUDA build of PyTorch for a CPU build. (On Apple Silicon follow `install.sh`, which installs SAM-Audio without decord/xformers.)
### 6. Install backend dependencies
```bash
cd backend
pip install -c constraints.txt -r requirements.txt # also pins transformers<5 and huggingface_hub<1.0
```
### 7. Install frontend dependencies
```bash
cd frontend
npm ci
```
### 8. Start services
**Terminal 1 - Backend API:**
```bash
cd backend
uvicorn main:app --port 8000
```
**Terminal 2 - Celery Worker:**
```bash
conda activate audioghost
cd backend
celery -A workers.celery_app worker --loglevel=info --pool=solo
```
**Terminal 3 - Frontend:**
```bash
cd frontend
npm run dev
```
### 9. Open the app
Navigate to `http://localhost:3000`, then [accept the model license](#first-run-accept-the-model-license).
## Configuration (environment variables)
| Variable | Default | Meaning |
|---|---|---|
| `AUDIOGHOST_PRECISION` | `fp16` | Transformer precision when *Full FP32* is off: `fp16`, or `bf16` (uses the fp32 model files) |
| `AUDIOGHOST_PRELOAD_MODEL` | - | `small` / `base` / `large`: load a model when the worker starts |
| `AUDIOGHOST_DEVICE` | auto | Force `cuda`, `cuda:1`, `cpu`, or `mps` (Apple GPU, experimental; runs in fp32 unless `AUDIOGHOST_PRECISION` is set) |
| `AUDIOGHOST_SAFE_CODEC` | `0` | `1` = use SAM-Audio's original (slow, cuDNN-off) codec path |
| `AUDIOGHOST_RETENTION_HOURS` | `0` | Delete projects untouched for this many hours (`0` = keep them until they are deleted by hand) |
| `AUDIOGHOST_MAX_UPLOAD_MB` | `2048` | Upload size limit |
| `AUDIOGHOST_REDIS_URL` | `redis://localhost:6379/0` | Celery broker / result backend |
| `HF_HOME` | `~/.cache/huggingface` | Where downloaded models are stored |
| `AUDIOGHOST_MODEL_DIR` | - | A folder of model files laid out like the repos (`sam-audio-/`, `sam-audio-shared/`), used instead of downloading |
| `AUDIOGHOST_MODEL_ORG` | `audioghostai` | Hugging Face organization the models download from (for a mirror) |
| `NEXT_PUBLIC_API_BASE` | `http://localhost:8000` | Where the web UI finds the API |
## API Reference
Interactive docs: `http://localhost:8000/docs`
### Sessions
| Method | Path | Purpose |
|---|---|---|
| `POST` | `/api/sessions` | Upload a file (multipart `file`); returns the session |
| `GET` | `/api/sessions` | Sessions, newest first, with their size on disk |
| `GET` | `/api/sessions/{id}` | A session with its tracks, progress and file URLs |
| `DELETE` | `/api/sessions/{id}` | Delete a session |
| `POST` | `/api/sessions/{id}/separate` | Queue one or more prompts, one track each (JSON below) |
| `DELETE` | `/api/sessions/{id}/tracks/{track}` | Cancel a running track, or remove a queued or finished one |
| `POST` | `/api/sessions/{id}/tracks/{track}/activate` | Make a finished take the one that plays for its sound |
| `POST` | `/api/sessions/{id}/rest/rebuild` | Run the chain of "everything else" again (`order`: sound ids, first removed first; `seed`; model settings) |
| `DELETE` | `/api/sessions/{id}/rest/job` | Cancel that rebuild |
| `POST` / `DELETE` | `/api/sessions/{id}/rest/{rev}[/activate]` | Go back to a kept version of "everything else", or delete one |
| `GET` | `/api/sessions/{id}/files/{name}` | Audio, waveform overviews and the source video (Range requests) |
| `POST` | `/api/sessions/{id}/export` | `kind`: `mix`, `tracks` (ZIP) or `video`; `format`: `wav`, `flac` or `mp3`; `gains`: linear gain per track id and `"rest"`; `segments`: parts of the file with other gains (`start`, `end`, `gains`); `tracks`: ids for `tracks` |
| `POST` / `GET` | `/api/batches` | Create a batch from a recipe (`prompts` with a `gain` each, `rest_gain`, model settings, `kind`, `format`), or list them |
| `GET` / `DELETE` | `/api/batches/{id}` | A batch with each file's progress; forget it (`?sessions=true` deletes its sessions too) |
| `POST` | `/api/batches/{id}/items` | Add a file (multipart `file`): it becomes a session and is queued |
| `GET` | `/api/batches/{id}/items/{session}/export` | One file's result |
| `POST` | `/api/batches/{id}/export` | Every finished result in one ZIP |
| `GET` | `/api/system/status` | Redis and worker status, GPU, loaded model |
| `GET` | `/api/auth/status` | Models on this computer, license accepted, Hugging Face connection |
| `GET` | `/api/models/license` | Meta's SAM License text, and whether it was accepted |
| `POST` | `/api/models/license/accept` | Accept it (once, before the first model download) |
```json
{
"prompts": [
{ "text": "speech" },
{ "text": "background music", "anchors": [["+", 12.0, 18.5], ["-", 40.0, 44.0]] }
],
"model_size": "base", "quality": "balanced", "variant": "default",
"stereo": true, "use_float32": false, "chunk_duration": 25,
"seed": 1234, "range": [60.0, 90.0]
}
```
Anchors are optional: `"+"` = the sound is audible here, `"-"` = it isn't (start and end in seconds). `seed` (random when left out; each track reports the one it used) repeats a result. `range` separates only that part of the file. A prompt with `"retake_of": "