Chat

Machine Learning in Linux: Bark – Text-Prompted Generative Audio

Example Python File

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, welcome to LinuxLinks. [laughs] 
       We hope you love our content. ♪
"""
audio_array = generate_audio(text_prompt)

# save audio to disk
write_wav("bark-LinuxLinks.wav", SAMPLE_RATE, audio_array)
  
# play text in notebook
Audio(audio_array, rate=SAMPLE_RATE)

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary
Page 3 – Example Python File

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Carlos
Carlos
1 year ago

Never heard of Bark before. It looks kinda interesting. I’ll give it a whirl under Ubuntu.

James
James
1 year ago
Reply to  Carlos

I’m using Debian so I should be able to get it working.

Neil
Neil
1 year ago
Reply to  James

do what?

Mel
Mel
1 year ago

Can you run Bark without a dedicated graphics card? I’ve got a 5th generation Intel machine with 8GB of RAM.