Text-Prompted Generative Audio Model 文字转语音,可嵌入语气,噪音等 https://github.com/suno-ai/bark
天问 2247f2707a Update 'README.md' | 1 year ago | |
---|---|---|
README.md | 1 year ago |
Examples • Suno Studio Waitlist • Updates • How to Use • Installation • [FAQ
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.
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.
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)
dc4477b9
-2da0-4b94-9c8b-a8c2d8f5bb
.webm)
*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.*
97f5ea23
-ad99-473c-924b-66b6fab242
.webm)
8b8e8749ed
?v=bc67cff786
), or in the [code](bark/assets/prompts). The community also often shares presets in [Discord](https://discord.gg/J2B2vsjKuE).
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.
a344c619
-a560-4ff5-8b99-b4463a3448
.webm)
By default, generate_audio
works well with around 13 seconds of spoken text. For an example of how to do long-form generation, see this example notebook.
f57608da
-e4cb-4062-8771-148e29512b
.webm)
[longform_advanced.webm](https://user-images.githubusercontent.com/2565833/235463547-1c0d8744
-269b-43fe-9630-897ea57316
.webm)
[longform_basic.webm](https://user-images.githubusercontent.com/2565833/235463559-87efe9f8
-a2db-4d59-b764-57db83f952
.webm)
pip install git+https://github.com/suno-ai/bark.git
or
git clone https://github.com/suno-ai/bark
cd bark && pip install .
Note: Do NOT use 'pip install bark'. It installs a different package, which is not managed by Suno.
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 smaller models. Details can be found in out tutorial sections here.
The full version of Bark requires around 12GB of VRAM to hold everything on GPU at the same time.
To use a smaller version of the models, which should fit into 8GB VRAM, set the environment flag SUNO_USE_SMALL_MODELS=True
.
If you don't have hardware available or if you want to play with bigger versions of our models, you can also sign up for early access to our model playground here.
Bark is fully generative tex-to-audio model devolved for research and demo purposes. It follows a GPT style architecture similar to AudioLM and Vall-E and a quantized Audio representation from EnCodec. It is not a conventional TTS model, but instead a fully generative text-to-audio model capable of deviating in unexpected ways from any given script. Different to previous approaches, the input text prompt is converted directly to audio without the intermediate use of phonemes. It can therefore generalize to arbitrary instructions beyond speech such as music lyrics, sound effects or other non-speech sounds.
Below is a list of some known non-speech sounds, but we are finding more every day. Please let us know if you find patterns that work particularly well on Discord!
[laughter]
[laughs]
[sighs]
[music]
[gasps]
[clears throat]
—
or ...
for hesitations♪
for song lyrics[MAN]
and [WOMAN]
to bias Bark toward male and female speakers, respectivelyLanguage | Status |
---|---|
English (en) | ✅ |
German (de) | ✅ |
Spanish (es) | ✅ |
French (fr) | ✅ |
Hindi (hi) | ✅ |
Italian (it) | ✅ |
Japanese (ja) | ✅ |
Korean (ko) | ✅ |
Polish (pl) | ✅ |
Portuguese (pt) | ✅ |
Russian (ru) | ✅ |
Turkish (tr) | ✅ |
Chinese, simplified (zh) | ✅ |
Requests for future language support here or in the #forums channel on Discord.
Bark is licensed under the MIT License.
Please contact us at bark@suno.ai
to request access to a larger version of the model.
We’re developing a playground for our models, including Bark.
If you are interested, you can sign up for early access here.
The full version of Bark requires around 12Gb of memory to hold everything on GPU at the same time. However, even smaller cards down to ~2Gb work with some additional settings. Simply add the following code snippet before your generation:
import os
os.environ["SUNO_OFFLOAD_CPU"] = True
os.environ["SUNO_USE_SMALL_MODELS"] = True