DEV Community

Alex Spinov
Alex Spinov

Posted on

Bark Has a Free API — AI Text-to-Speech That Sounds Human

Bark: Generative Audio Beyond Traditional TTS

Bark by Suno AI generates realistic speech with emotions, laughter, music, and sound effects. Unlike robotic TTS, Bark captures natural human speech patterns in 13+ languages.

What Makes Bark Special

  • Natural emotions: laughter, sighing, hesitation
  • 13+ languages with native speaker quality
  • Music and sound effects from text
  • Speaker presets for consistent voices
  • Runs on consumer GPUs (6GB+ VRAM)

The Free API

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

preload_models()

# Basic speech
audio = generate_audio(
    "Hello! This is Bark generating natural speech.",
    history_prompt="v2/en_speaker_6"
)
write_wav("output.wav", SAMPLE_RATE, audio)

# With emotions
audio = generate_audio("I can NOT believe it worked! [laughs]")

# Other languages
audio = generate_audio("Bonjour le monde!", history_prompt="v2/fr_speaker_0")
Enter fullscreen mode Exit fullscreen mode

Special Audio Tags

# Laughter
generate_audio("So funny [laughs]")

# Music
generate_audio("La la la, singing a song")

# Hesitation
generate_audio("I think... um... maybe...")
Enter fullscreen mode Exit fullscreen mode

Batch Processing for Podcasts

import numpy as np
from bark import generate_audio, SAMPLE_RATE

scripts = ["Welcome to our show.", "Today: AI trends.", "Lets go!"]
all_audio = []
for text in scripts:
    audio = generate_audio(text, history_prompt="v2/en_speaker_6")
    all_audio.append(audio)
    all_audio.append(np.zeros(int(0.5 * SAMPLE_RATE)))

write_wav("podcast.wav", SAMPLE_RATE, np.concatenate(all_audio))
Enter fullscreen mode Exit fullscreen mode

Real-World Use Case

A content creator needed voiceovers for 50 YouTube shorts in 3 languages. Bark generated narration with emotional inflections. Cost: $0. Time: 2 hours on RTX 3080.

Quick Start

pip install git+https://github.com/suno-ai/bark.git
python -c "from bark import generate_audio; print(type(generate_audio(Hello)))"
Enter fullscreen mode Exit fullscreen mode

Resources


Need automated AI content pipelines? Check out my tools on Apify or email spinov001@gmail.com for custom AI solutions.

Top comments (0)