Bark
π Text-Prompted Generative Audio Model
Install / Use
/learn @suno-ai/BarkREADME
Notice: Bark is Suno's open-source text-to-speech+ model. If you are looking for our text-to-music models, please visit us on our web page and join our community on Discord.
πΆ Bark
π Examples β’ Suno Studio Waitlist β’ Updates β’ How to Use β’ Installation β’ FAQ
<br>
<p align="center"> <img src="https://user-images.githubusercontent.com/5068315/235310676-a4b3b511-90ec-4edf-8153-7ccf14905d73.png" width="500"></img> </p> <br>Bark is a transformer-based text-to-audio model created by Suno. Bark can generate highly realistic, multilingual speech as well as other audio - including music, background noise and simple sound effects. The model can also produce nonverbal communications like laughing, sighing and crying. To support the research community, we are providing access to pretrained model checkpoints, which are ready for inference and available for commercial use.
β Disclaimer
Bark was developed for research purposes. It is not a conventional text-to-speech model but instead a fully generative text-to-audio model, which can deviate in unexpected ways from provided prompts. Suno does not take responsibility for any output generated. Use at your own risk, and please act responsibly.
π Quick Index
π§ Demos
π Updates
2023.05.01
-
Β©οΈ Bark is now licensed under the MIT License, meaning it's now available for commercial use!
-
β‘ 2x speed-up on GPU. 10x speed-up on CPU. We also added an option for a smaller version of Bark, which offers additional speed-up with the trade-off of slightly lower quality.
-
π Long-form generation, voice consistency enhancements and other examples are now documented in a new notebooks section.
-
π₯ We created a voice prompt library. We hope this resource helps you find useful prompts for your use cases! You can also join us on Discord, where the community actively shares useful prompts in the #audio-prompts channel.
-
π¬ Growing community support and access to new features here:
-
πΎ You can now use Bark with GPUs that have low VRAM (<4GB).
2023.04.20
- πΆ Bark release!
π Usage in Python
<details open> <summary><h3>πͺ Basics</h3></summary>from bark import SAMPLE_RATE, generate_audio, preload_models
from scipy.io.wavfile import write as write_wav
from IPython.display import Audio
# download and load all models
preload_models()
# generate audio from text
text_prompt = """
Hello, my name is Suno. And, uh β and I like pizza. [laughs]
But I also have other interests such as playing tic tac toe.
"""
audio_array = generate_audio(text_prompt)
# save audio to disk
write_wav("bark_generation.wav", SAMPLE_RATE, audio_array)
# play text in notebook
Audio(audio_array, rate=SAMPLE_RATE)
</details>
<details open>
<summary><h3>π Foreign Language</h3></summary>
<br>
Bark supports various languages out-of-the-box and automatically determines language from input text. When prompted with code-switched text, Bark will attempt to employ the native accent for the respective languages. English quality is best for the time being, and we expect other languages to further improve with scaling.
<br>
<br>
text_prompt = """
μΆμμ λ΄κ° κ°μ₯ μ’μνλ λͺ
μ μ΄λ€. λλ λ©°μΉ λμ ν΄μμ μ·¨νκ³ μΉκ΅¬ λ° κ°μ‘±κ³Ό μκ°μ λ³΄λΌ μ μμ΅λλ€.
"""
audio_array = generate_audio(text_prompt)
Note: since Bark recognizes languages automatically from input text, it is possible to use, for example, a german history prompt with english text. This usually leads to english audio with a german accent.
text_prompt = """
Der DreiΓigjΓ€hrige Krieg (1618-1648) war ein verheerender Konflikt, der Europa stark geprΓ€gt hat.
This is a beginning of the history. If you want to hear more, please continue.
"""
audio_array = generate_audio(text_prompt)
</details>
<details open>
<summary><h3>πΆ Music</h3></summary>
Bark can generate all types of audio, and, in principle, doesn't see a difference between speech and music. Sometimes Bark chooses to generate text as music, but you can help it out by adding music notes around your lyrics.
<br>
<br>
text_prompt = """
βͺ In the jungle, the mighty jungle, the lion barks tonight βͺ
"""
audio_array = generate_audio(text_prompt)
</details>
<details open>
<summary><h3>π€ Voice Presets</h3></summary>
Bark supports 100+ speaker presets across supported languages. You can browse the library of supported voice presets HERE, or in the code. The community also often shares presets in Discord.
Bark tries to match the tone, pitch, emotion and prosody of a given preset, but does not currently support custom voice cloning. The model also attempts to preserve music, ambient noise, etc.
text_prompt = """
I have a silky smooth voice, and today I will tell you about
the exercise regimen of the common sloth.
"""
audio_array = generate_audio(text_prompt, history_prompt="v2/en_speaker_1")
</details>
π Generating Longer Audio
By default, generate_audio works well with around 13 seconds of spoken text. For an example of how to do long-form generation, see π Notebook π
Command line
python -m bark --text "Hello, my name is Suno." --output_filename "example.wav"
π» Installation
βΌοΈ CAUTION βΌοΈ Do NOT use pip install bark. It installs a different package, which is not managed by Suno.
pip install git+https://github.com/suno-ai/bark.git
or
git clone https://github.com/suno-ai/bark
cd bark && pip install .
π€ Transformers Usage
Bark is available in the π€ Transformers library from version 4.31.0 onwards, requiring minimal dependencies and additional packages. Steps to get started:
- First install the π€ Transformers library from main:
pip install git+https://github.com/huggingface/transformers.git
- Run the following Python code to generate speech samples:
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()
- Listen to the audio samples either in an ipynb notebook:
from IPython.display import Audio
sample_rate = model.generation_config.sample_rate
Audio(audio_array, rate=sample_rate)
Or save them as a .wav file using a third-party library, e.g. scipy:
import scipy
sample_rate = model.generation_config.sample_rate
scipy.io.wavfile.write("bark_out.wav", rate=sample_rate, data=audio_array)
For more details on using the Bark model for inference using the π€ Transformers library, refer to the Bark docs or the hands-on Google Colab.
π οΈ Hardware and Inference Speed
Bark has been tested and works on both CPU and GPU (pytorch 2.0+, CUDA 11.7 and CUDA 12.0).
On enterprise GPUs and PyTorch nightly, Bark can generate audio in roughly real-time. On older GPUs, default colab, or CPU, inference time might be significantly slower. For older GPUs or CPU you might want to consider using
Related Skills
node-connect
328.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
80.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
328.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
80.9kCommit, push, and open a PR
