# Bark User Guide

Bark is a transformer-based **text-to-audio** model from [Suno](https://suno.ai). You give it text, and it generates highly realistic, multilingual speech — plus things most speech models can't do: laughter, sighs, singing, music, sound effects, and background noise. It runs entirely on your own machine using pretrained model checkpoints that download automatically the first time you use them.

This guide shows you how to install Bark, generate your first audio, steer the voice and emotion of the output, work in 13 languages, and solve the problems people hit most often.

> [!NOTE]
> Bark is a **fully generative** text-to-audio model, not a conventional text-to-speech engine. It converts text directly to audio with no intermediate phoneme step, so it can take creative liberties and occasionally deviate from your prompt. This is by design — see [Why does the output differ from my prompt?](#frequently-asked-questions).

---

## 1. Quick Start

Generate your first audio clip in three steps.

### Step 1 — Install Bark

```bash
pip install git+https://github.com/suno-ai/bark.git
```

> [!CAUTION]
> Do **NOT** run `pip install bark`. That installs a completely different, unrelated package that is not maintained by Suno. Always install from the GitHub URL above (or from a clone — see [Installation](#2-installation)).

### Step 2 — Generate audio in Python

```python
from bark import SAMPLE_RATE, generate_audio, preload_models
from scipy.io.wavfile import write as write_wav

# Download and load all models (first run only — downloads several GB)
preload_models()

# Generate audio from text
text_prompt = "Hello, my name is Suno. And, uh — and I like pizza. [laughs]"
audio_array = generate_audio(text_prompt)

# Save the result to disk
write_wav("bark_generation.wav", SAMPLE_RATE, audio_array)
```

```text
Done! bark_generation.wav written at 24 kHz.
```

### Step 3 — Or generate from the command line

```bash
python -m bark --text "Hello, my name is Suno." --output_filename "example.wav"
```

```text
Done! Output audio file is saved at: './example.wav'
```

> [!IMPORTANT]
> The **first** call to `preload_models()` (or the first CLI run) downloads the model checkpoints from Hugging Face into `~/.cache/suno/bark_v0`. This is a one-time download of several gigabytes. Subsequent runs load from cache and start almost immediately.

> [!TIP]
> All audio Bark produces is a NumPy array sampled at **24 kHz**. Always use the exported `SAMPLE_RATE` constant (`24000`) when saving or playing audio so the pitch and speed are correct.

---

## 2. Installation

### Requirements

| Requirement | Detail |
|---|---|
| Python | 3.8 or newer |
| PyTorch | 2.0+ recommended (tested with CUDA 11.7 and CUDA 12.0) |
| Hardware | Runs on **CPU or GPU**. GPU strongly recommended for speed. |
| Disk | Several GB free for model checkpoints in `~/.cache/suno/bark_v0` |
| VRAM (GPU) | ~12 GB full models · ~8 GB small models · down to ~2 GB with offloading |

Bark's core dependencies (`torch`, `transformers`, `encodec`, `huggingface-hub`, `scipy`, `numpy`, `funcy`, `tqdm`, `tokenizers`) are installed automatically.

### Installation methods

=== "pip + Git (recommended)"

    ```bash
    pip install git+https://github.com/suno-ai/bark.git
    ```

=== "Clone and install"

    ```bash
    git clone https://github.com/suno-ai/bark
    cd bark && pip install .
    ```

=== "Hugging Face Transformers"

    Bark is also available inside the 🤗 Transformers library (v4.31.0+) with a different API:

    ```bash
    pip install git+https://github.com/huggingface/transformers.git
    ```

    See [Using Bark through Hugging Face Transformers](#7-using-bark-through-hugging-face-transformers).

> [!WARNING]
> The package name on PyPI (`suno-bark`) is **not** the same as `bark`. Installing the plain `bark` package will pull in unrelated code. Use the Git install or a local clone.

### Verify the installation

```python
import bark
from bark import generate_audio, preload_models, SAMPLE_RATE
print("Bark imported OK — sample rate:", SAMPLE_RATE)
```

```text
Bark imported OK — sample rate: 24000
```

---

## 3. Generating Audio

The single function you will use most is `generate_audio()`.

```python
from bark import generate_audio, SAMPLE_RATE
from scipy.io.wavfile import write as write_wav

audio_array = generate_audio("It was a dark and stormy night.")
write_wav("story.wav", SAMPLE_RATE, audio_array)
```

### `generate_audio()` parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `text` | `str` | *(required)* | The text to turn into audio. |
| `history_prompt` | `str` or `dict` | `None` | A voice preset name, a path to a `.npz` prompt file, or a full-generation dict. Controls the voice. See [Choosing a Voice](#5-choosing-a-voice-voice-presets). |
| `text_temp` | `float` | `0.7` | Temperature for the text→semantic stage. Higher (toward `1.0`) = more diverse/expressive; lower (toward `0.0`) = more conservative/stable. |
| `waveform_temp` | `float` | `0.7` | Temperature for the audio waveform stage. Same trade-off as `text_temp`. |
| `silent` | `bool` | `False` | Disable the progress bar. |
| `output_full` | `bool` | `False` | If `True`, also return the full generation dict (reusable as a `history_prompt`). |

> [!TIP]
> Lower the temperatures (e.g. `text_temp=0.5`, `waveform_temp=0.5`) when you want steadier, more predictable narration. Raise them toward `1.0` for more expressive, varied delivery.

### Returning the full generation

Set `output_full=True` to receive both the generation data and the audio. The first element can be saved and reused as a voice prompt for consistency across clips (see [Long-Form Audio](#6-long-form-and-consistent-voices)).

```python
full_generation, audio_array = generate_audio(
    "I will narrate the next several chapters.",
    output_full=True,
)
```

> [!NOTE]
> By default `generate_audio` works best with about **13 seconds** of spoken text per call. For longer content, chain calls — see [Long-Form and Consistent Voices](#6-long-form-and-consistent-voices).

---

## 4. Command-Line Interface

Bark ships a small CLI invoked with `python -m bark`. It wraps `generate_audio()` and writes a `.wav` file.

```bash
python -m bark --text "Welcome to the show." --output_filename "intro.wav" --output_dir "./clips"
```

```text
Done! Output audio file is saved at: './clips/intro.wav'
```

### CLI options

| Option | Type | Default | Description |
|---|---|---|---|
| `--text` | `str` | — | Text to be turned into audio. |
| `--output_filename` | `str` | `bark_generation.wav` | Output audio file name. |
| `--output_dir` | `str` | `.` | Directory to save the output (created if missing). |
| `--history_prompt` | `str` | `None` | Voice choice — a preset name or a path to a `.npz` file. |
| `--text_temp` | `float` | `0.7` | Generation temperature (1.0 more diverse, 0.0 more conservative). |
| `--waveform_temp` | `float` | `0.7` | Generation temperature (1.0 more diverse, 0.0 more conservative). |
| `--silent` | `bool` | `False` | Disable the progress bar. |
| `--output_full` | `bool` | `False` | Return the full generation to be used as a history prompt. |

#### Example: CLI with a voice preset

```bash
python -m bark \
  --text "I have a silky smooth voice." \
  --history_prompt "v2/en_speaker_1" \
  --output_filename "smooth.wav"
```

> [!WARNING]
> The `--silent` and `--output_full` flags use Python's `type=bool` parsing, which treats **any non-empty value as `True`**. That means `--silent False` actually enables silent mode, because the string `"False"` is truthy. **To leave these flags off, simply omit them.** Pass `--silent True` (or `--silent anything`) to turn the flag on.

---

## 5. Choosing a Voice (Voice Presets)

By default Bark picks a voice that fits your text, and it can pick a different one each run. To get a **consistent, known voice**, pass a *voice preset* via `history_prompt`.

```python
audio_array = generate_audio(
    "Today I will tell you about the exercise regimen of the common sloth.",
    history_prompt="v2/en_speaker_1",
)
```

### Available presets

Bark bundles **100+ speaker presets**. Preset names follow these patterns:

| Preset pattern | Example | Notes |
|---|---|---|
| `{lang}_speaker_{0–9}` | `en_speaker_3` | 10 speakers per language, original set. |
| `v2/{lang}_speaker_{0–9}` | `v2/en_speaker_6` | **Recommended.** v2 prompts follow text with a more consistent voice. |
| `announcer` | `announcer` | A special "announcer" voice. |

`{lang}` is one of the 13 [supported language codes](#8-supported-languages) (`en`, `de`, `es`, `fr`, `hi`, `it`, `ja`, `ko`, `pl`, `pt`, `ru`, `tr`, `zh`). The bundled presets live in `bark/assets/prompts/` (originals) and `bark/assets/prompts/v2/` (v2).

> [!TIP]
> Prefer the **`v2/` presets** — they are better engineered to follow your text with a consistent voice. For example, use `v2/en_speaker_6` rather than `en_speaker_6`.

> [!NOTE]
> Bark matches the **tone, pitch, emotion, and prosody** of a preset, and tries to preserve music and ambient characteristics. It does **not** currently support custom voice cloning from your own recordings.

### Using your own saved prompt

A `history_prompt` can also be a path to a `.npz` file you previously saved (see [Long-Form and Consistent Voices](#6-long-form-and-consistent-voices)):

```python
audio_array = generate_audio("Continuing the story...", history_prompt="my_voice.npz")
```

---

## 6. Long-Form and Consistent Voices

A single `generate_audio` call targets ~13 seconds of audio. To produce longer content with a **stable voice**, generate the first segment with `output_full=True`, save that generation as a prompt, and feed it back into the next segment.

```python
from bark import generate_audio, save_as_prompt, SAMPLE_RATE
from scipy.io.wavfile import write as write_wav
import numpy as np

sentences = [
    "Chapter one. The morning began quietly.",
    "By noon, everything had changed.",
    "And so the adventure truly began.",
]

# Generate the first segment and capture its full generation
full_generation, first_audio = generate_audio(sentences[0], output_full=True)

# Reuse that generation as the voice prompt for the remaining segments
pieces = [first_audio]
for line in sentences[1:]:
    audio = generate_audio(line, history_prompt=full_generation)
    pieces.append(audio)

# Concatenate and save
combined = np.concatenate(pieces)
write_wav("long_form.wav", SAMPLE_RATE, combined)
```

### Saving a voice for later

Use `save_as_prompt()` to persist a full generation to a `.npz` file you can reuse across sessions:

```python
from bark import save_as_prompt

full_generation, audio = generate_audio("My narrator voice.", output_full=True)
save_as_prompt("narrator.npz", full_generation)

# Later, in another script:
audio2 = generate_audio("Picking up where we left off.", history_prompt="narrator.npz")
```

> [!IMPORTANT]
> `save_as_prompt()` requires the file path to end in `.npz` and the generation to contain the keys `semantic_prompt`, `coarse_prompt`, and `fine_prompt` — exactly the dict you get from `output_full=True`. Passing anything else raises an assertion error.

> [!TIP]
> Worked examples of long-form generation, voice consistency, and running on CPU live in the repository's [`notebooks/`](https://github.com/suno-ai/bark/tree/main/notebooks) folder: `long_form_generation.ipynb`, `use_small_models_on_cpu.ipynb`, and `memory_profiling_bark.ipynb`.

---

## 7. Expressive Audio: Sounds, Music, and Emphasis

Because Bark generates audio rather than reading text literally, you can embed special cues directly in your text to produce nonverbal sounds, singing, and emphasis.

### Nonverbal and special tokens

| Cue | Effect |
|---|---|
| `[laughter]`, `[laughs]` | Laughter |
| `[sighs]` | A sigh |
| `[music]` | Musical sound |
| `[gasps]` | A gasp |
| `[clears throat]` | Throat-clearing |
| `—` or `...` | Hesitations / pauses |
| `♪` | Wraps song lyrics so Bark sings them |
| `CAPITALIZATION` | Emphasis on a word |
| `[MAN]` / `[WOMAN]` | Bias toward a male / female speaker |

```python
# Speech with nonverbal sounds
generate_audio("I can't believe it [laughs] — that's incredible!")

# Singing
generate_audio("♪ In the jungle, the mighty jungle, the lion barks tonight ♪")

# Emphasis and a hesitation
generate_audio("This is REALLY important... so listen carefully.")
```

> [!NOTE]
> This list is not exhaustive — Bark can produce many nonverbal sounds, and new working patterns are discovered regularly. The community shares effective prompts in the project's Discord `#audio-prompts` channel.

### Generating music

Bark doesn't strictly distinguish speech from music. To nudge it toward singing, wrap lyrics in music notes (`♪`). Results vary — Bark may still choose to speak lyrics rather than sing them.

> [!TIP]
> For dedicated text-to-**music** generation, Bark is not the right tool. Suno's music models live on the [Suno web app](https://suno.ai), separate from this repository.

---

## 8. Foreign Languages

Bark **automatically detects the language** from your input text — you don't specify it explicitly.

```python
# Korean — detected automatically
generate_audio("추석은 내가 가장 좋아하는 명절이다.")

# German
generate_audio("Der Dreißigjährige Krieg war ein verheerender Konflikt.")
```

### Supported languages

| Language | Code | Language | Code |
|---|:---:|---|:---:|
| English | `en` | Italian | `it` |
| German | `de` | Japanese | `ja` |
| Spanish | `es` | Korean | `ko` |
| French | `fr` | Polish | `pl` |
| Hindi | `hi` | Portuguese | `pt` |
| Russian | `ru` | Turkish | `tr` |
| Chinese (simplified) | `zh` | | |

> [!NOTE]
> English quality is best at the moment; other languages continue to improve. Because language is auto-detected, you can deliberately mix a non-English voice preset with English text to get an accented English voice — for example, a German history prompt with English text usually yields English audio with a German accent.

> [!TIP]
> To pin the accent/voice for a given language, combine auto-detection with a matching `v2/{lang}_speaker_{n}` preset, e.g. `history_prompt="v2/de_speaker_3"` for German.

---

## 9. Running on Limited Hardware

Bark runs on modest GPUs and even CPU-only machines if you enable the right options. These are controlled by **environment variables**, set *before* importing Bark.

| Environment variable | Default | Effect |
|---|---|---|
| `SUNO_USE_SMALL_MODELS` | `False` | Use smaller model versions — fits ~8 GB VRAM, slightly lower quality, faster. |
| `SUNO_OFFLOAD_CPU` | `False` | Keep models on CPU and move them to GPU only when needed — large VRAM savings. |
| `SUNO_ENABLE_MPS` | `False` | Enable Apple Silicon (MPS) GPU acceleration on Macs. |

### Low-VRAM recipe (down to ~2 GB)

```python
import os
os.environ["SUNO_OFFLOAD_CPU"] = "True"
os.environ["SUNO_USE_SMALL_MODELS"] = "True"

from bark import generate_audio, preload_models, SAMPLE_RATE
preload_models()
audio_array = generate_audio("Running on a small GPU.")
```

> [!IMPORTANT]
> Set these environment variables **before** the `from bark import ...` line. They are read when the `bark.generation` module is first imported; setting them afterward has no effect within the same process.

> [!TIP]
> On Apple Silicon, set `SUNO_ENABLE_MPS=True`. Note that the EnCodec audio codec step does not support MPS and automatically falls back to CPU — this is expected.

> [!WARNING]
> If no GPU is detected, Bark prints `No GPU being used. Careful, inference might be very slow!` and runs on CPU. CPU inference works but can be many times slower than GPU.

---

## 10. Using Bark Through Hugging Face Transformers

Bark is also integrated into the 🤗 Transformers library (v4.31.0+), which offers a different, model-object-style API.

```python
from transformers import AutoProcessor, BarkModel

processor = AutoProcessor.from_pretrained("suno/bark")
model = BarkModel.from_pretrained("suno/bark")

voice_preset = "v2/en_speaker_6"
inputs = processor("Hello, my dog is cute", voice_preset=voice_preset)

audio_array = model.generate(**inputs)
audio_array = audio_array.cpu().numpy().squeeze()
```

Save the result with the model's own sample rate:

```python
import scipy
sample_rate = model.generation_config.sample_rate
scipy.io.wavfile.write("bark_out.wav", rate=sample_rate, data=audio_array)
```

> [!NOTE]
> The Transformers integration is a separate code path from this repository's `bark` package. Use whichever fits your stack. For full details, see the [Bark page in the Transformers docs](https://huggingface.co/docs/transformers/main/en/model_doc/bark).

---

## 11. Troubleshooting

### Error: `history prompt not found`

- **Cause:** You passed a `history_prompt` preset name that isn't one of the bundled presets (e.g. a typo, or a name outside the `{lang}_speaker_{0–9}` / `v2/...` / `announcer` set).
- **Solution:** Use a valid preset name (see [Choosing a Voice](#5-choosing-a-voice-voice-presets)), or pass a path to a real `.npz` file.
- **Prevention:** Stick to the documented preset patterns; remember preset names are case-sensitive and use the `v2/` prefix for v2 voices.

### Error: `history prompt format unrecognized`

- **Cause:** The `history_prompt` value was neither a `.npz` path, a known preset name, nor a valid generation dict.
- **Solution:** Pass a string ending in `.npz`, a preset name, or the dict returned by `generate_audio(..., output_full=True)`.
- **Prevention:** Reuse the exact `full_generation` dict from `output_full=True`, or save it with `save_as_prompt()` and pass that file path.

### Error: `extra keys found: {...}` / `missing keys: {...}`

- **Cause:** A model checkpoint doesn't match the expected model architecture (corrupt, partial, or wrong-version download).
- **Solution:** Force a fresh download by clearing the cache directory `~/.cache/suno/bark_v0` (or call `preload_models(force_reload=True)`), then retry.
- **Prevention:** Let the first run complete its download fully before interrupting.

### Warning: `warning, text too long, lopping of last X%`

- **Cause:** Your text exceeds the model's ~256-token text window for a single call, so the end is truncated.
- **Solution:** Split long text into shorter segments and chain them — see [Long-Form and Consistent Voices](#6-long-form-and-consistent-voices).
- **Prevention:** Keep each `generate_audio` call to roughly one or two sentences (~13 seconds of speech).

### Problem: Checkpoint fails to load on newer PyTorch (weights-only error)

- **Cause:** PyTorch 2.6+ changed `torch.load` to default to `weights_only=True`, which can reject Bark's checkpoint format. Reported in issues [#656](https://github.com/suno-ai/bark/issues/656) and [#626](https://github.com/suno-ai/bark/issues/626).
- **Solution:** Use a PyTorch version known to work with Bark (2.0–2.5), or apply the workaround discussed in the linked issues.
- **Prevention:** Pin your `torch` version in your environment when relying on Bark's bundled loader.

### Problem: Where are models downloaded, and how do I change it?

- **Cause:** Bark caches models under `~/.cache/suno/bark_v0`, derived from the Hugging Face cache. Reported as a question in [#341](https://github.com/suno-ai/bark/issues/341).
- **Solution:** Set the standard Hugging Face cache environment variable (`HF_HOME`) — or `XDG_CACHE_HOME` — before importing Bark to relocate downloads. See [How do I change the model download location?](#frequently-asked-questions).
- **Prevention:** Set the cache location once in your environment so all runs share the same model files.

### Problem: Audio sounds low-fidelity, like an old phone call

- **Cause:** Bark generates audio from scratch and is not constrained to studio-quality speech; outputs vary in fidelity.
- **Solution:** Try a different (or `v2/`) voice preset, lower the temperatures for steadier output, and regenerate — results vary per run.
- **Prevention:** Use `v2/` presets and moderate temperatures for the most consistent quality.

### Problem: Generation is extremely slow

- **Cause:** Running on CPU, or on a GPU without the optimizations.
- **Solution:** Use a CUDA-capable GPU, upgrade to a recent PyTorch (2.0+) for flash attention, and/or enable `SUNO_USE_SMALL_MODELS=True`.
- **Prevention:** Confirm a GPU is detected — if you see `No GPU being used`, Bark is on CPU.

### Problem: `ModuleNotFoundError` or dependency conflicts during install

- **Cause:** A broken Python build or conflicting `torch`/`torchvision` versions (e.g. issues [#543](https://github.com/suno-ai/bark/issues/543), [#292](https://github.com/suno-ai/bark/issues/292)).
- **Solution:** Install Bark in a fresh virtual environment and let it resolve its own dependency set.
- **Prevention:** Avoid mixing Bark into an environment with pinned, incompatible `torch` versions.

---

## 12. Frequently Asked Questions

**Q: How do I change where models are downloaded and cached?**

Bark uses Hugging Face to download and store models, defaulting to `~/.cache/suno/bark_v0`. Set the standard Hugging Face environment variable `HF_HOME` (or `XDG_CACHE_HOME`) before importing Bark to relocate the cache. See the [Hugging Face environment variables docs](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables).

**Q: Why does the output differ from my prompt?**

Bark is a GPT-style generative model. Like other generative models, it may take creative liberties, producing higher-variance output than traditional text-to-speech. Lower the temperatures (`text_temp`, `waveform_temp`) for steadier results.

**Q: What voices are supported?**

100+ speaker presets across the [13 supported languages](#8-supported-languages), plus a special `announcer` voice. Bark can also generate unique random voices that fit your text. It does **not** currently support custom voice cloning.

**Q: Why is output limited to about 13–14 seconds?**

Bark's architecture and context window are optimized for generations of roughly this length. For longer audio, chain calls using a saved history prompt — see [Long-Form and Consistent Voices](#6-long-form-and-consistent-voices).

**Q: How much VRAM do I need?**

The full models need about 12 GB of GPU memory to hold everything at once. Smaller cards — down to ~2 GB — work by combining `SUNO_OFFLOAD_CPU=True` and `SUNO_USE_SMALL_MODELS=True`.

**Q: Can Bark generate music?**

Bark can produce singing and musical sounds (wrap lyrics in `♪`), but it is a text-to-audio model, not a dedicated music generator. For music, use Suno's music models on the [web app](https://suno.ai).

**Q: Can I use Bark commercially?**

Yes. As of the 2023-05-01 update Bark is released under the **MIT License**, which permits commercial use. Pretrained checkpoints are provided for inference and commercial use.

**Q: Does Bark do voice cloning?**

No. Bark matches the tone, pitch, and prosody of a built-in preset, but it does not currently support cloning a voice from your own audio.

**Q: How do I keep the same voice across multiple clips?**

Generate the first clip with `output_full=True`, then pass the returned generation (or a `.npz` saved with `save_as_prompt()`) as the `history_prompt` for subsequent clips.

---

## 13. Quick Reference

### Top-level API (`from bark import ...`)

| Symbol | Purpose |
|---|---|
| `generate_audio(text, ...)` | Generate a 24 kHz audio array from text. |
| `text_to_semantic(text, ...)` | First pipeline stage: text → semantic tokens. |
| `semantic_to_waveform(tokens, ...)` | Remaining stages: semantic tokens → audio array. |
| `save_as_prompt(filepath, full_generation)` | Save a generation dict to a reusable `.npz` prompt. |
| `preload_models(...)` | Download/load all models before generating. |
| `SAMPLE_RATE` | Output sample rate constant (`24000`). |

### CLI

```bash
python -m bark --text "..." [--output_filename NAME] [--output_dir DIR] \
  [--history_prompt PRESET_OR_PATH] [--text_temp 0.7] [--waveform_temp 0.7] \
  [--silent] [--output_full]
```

### Environment variables

| Variable | Default | Effect |
|---|---|---|
| `SUNO_USE_SMALL_MODELS` | `False` | Use small models (~8 GB VRAM). |
| `SUNO_OFFLOAD_CPU` | `False` | Offload models to CPU between use (low VRAM). |
| `SUNO_ENABLE_MPS` | `False` | Enable Apple Silicon GPU. |
| `HF_HOME` / `XDG_CACHE_HOME` | — | Relocate the model cache. |

### Text cues

`[laughter]` `[laughs]` `[sighs]` `[music]` `[gasps]` `[clears throat]` · `—` / `...` pauses · `♪ lyrics ♪` · `CAPS` emphasis · `[MAN]` / `[WOMAN]` speaker bias

### Key facts

| Fact | Value |
|---|---|
| Output sample rate | 24,000 Hz |
| Best per-call length | ~13 seconds |
| Supported languages | 13 (auto-detected) |
| Voice presets | 100+ (`v2/` recommended) |
| License | MIT (commercial use allowed) |
| Model cache | `~/.cache/suno/bark_v0` |

---

_Generated June 2026 from suno-ai/bark at f4f32d4. AI-generated documentation. The library is checked by sampling (three repositories so far); this guide was not individually reviewed. Verify against the project before relying on it. Unofficial; not affiliated with or reviewed by the project._
