Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Build a Voice-Over Tool for YouTube Videos

Why Voice‑Over Automation Matters for YouTube If you’ve ever tried to produce a YouTube video, you’ll know that the most time‑consuming part isn’t shooting footage or writing the script—it’s the audio. Recording a human voice, cleaning it up, and syncing it to the video can eat up hours of a creator’s day. That’s where text‑to‑speech (TTS) and voice‑cloning come in: they let you generate…

Why Voice-Over Automation Matters for YouTube

Creating YouTube videos involves more than just filming and writing scripts. The most time-consuming aspect is often the audio component—recording, editing, and syncing the voice with the video footage can consume significant hours of a creator’s day. To streamline this process, developers can leverage text-to-speech (TTS) technology and voice cloning tools. These solutions enable the generation of high-quality narration using a few lines of code.

Building a Lightweight Voice-Over Tool

In this guide, we'll walk you through constructing a simplified voice-over tool that accepts a script, converts it into a natural-sounding voice, and produces a subtitle file compatible with YouTube uploads. We'll utilize ElevenLabs as our TTS engine, renowned for its advanced neural voices and straightforward API integration.

Setting Up Your ElevenLabs Account

To get started, visit https://try.elevenlabs.io/kr07zfuqn1bp to create an account using the provided affiliate link. This link grants access to a generous quota of free synthesis hours. Once logged in, you'll need to register for an API key, which is essential for our code examples. Within the dashboard, you can also clone an existing voice or upload an audio sample to create a unique voice. Afterward, copy your API key from the "API" tab, as it will be required in our code snippets.

Choosing the Right Voice

ElevenLabs provides a diverse library of voices that you can employ. You can:

- Clone a real person's voice by providing a few minutes of clean audio.

- Select from pre-built "human-like" voices like "Sam" or "Emma" for quick setup.

- Choose a voice that aligns with your channel's tone—whether it's friendly, professional, or energetic.

When cloning a voice, you'll receive a unique voice ID, which you will reference in subsequent code snippets. Ensure the selected voice matches your desired channel tone.

Building the Core Synthesizer

Below is a concise Python script that communicates with the ElevenLabs API to generate an MP3 file from a script and subsequently writes an SRT subtitle file. You can modify this script to suit your preferred programming language.

```python

import requests

import json

import os

ELEVEN_API_URL = "https://api.elevenlabs.io/v1/text-to-speech"

API_KEY = "YOUR_ELEVEN_API_KEY"

VOICE_ID = "YOUR_CLONED_VOICE_ID"

# 1️⃣ Read the script

with open("script.txt", "r", encoding="utf-8") as f:

script = f.read()

# 2️⃣ Build the request payload

payload = {

"text": script,

"voice_settings": {

"stability": 0.75,

"similarity_boost": 0.8

}

}

headers = {

"xi-api-key": API_KEY,

"Content-Type": "application/json"

}

# 3️⃣ Make the request

response = requests.post(f"{ELEVEN_API_URL}/{VOICE_ID}", headers=headers, data=json.dumps(payload))

# 4️⃣ Save the MP3

if response.status_code == 200:

with open("narration.mp3", "wb") as out:

out.write(response.content)

print("✅ Audio generated!")

else:

print(f"❌ Error {response.status_code}: {response.text}")

```

The script reads the script from a text file, configures the TTS request with desired voice settings, and sends the request to ElevenLabs. If the response is successful (status code 200), the API returns raw MP3 bytes, which are saved to a file named "narration.mp3." Error handling is included to manage any API communication issues.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

The job ad was in English. The requirement was fluent German.

What I learned building an open-source AI job-search assistant for Germany, and what happened when strangers started using it.

  • Berlin Job Search tool aids German job listings
  • Identifies German language requirement in job ads
  • Tool improved based on user feedback

I generated every sprite and sound of my mobile game in code. Here's how.

Dash & Slash is a one-thumb roguelite for Android and iPhone: you pull back to aim, time slows to 20%, you let go and cut through everything on the line.

  • Dash & Slash features a single 512×512 texture atlas for all sprites
  • Sound effects and music loops generated via Python script
  • Rooms are 13×21 tile grids with flood fill algorithm for reachability

GhostShell: the terminal remembers the bug, and it does not press the keys

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine What I Built GhostShell is a terminal companion for the bug you already met.

  • GhostShell remembers bugs to prevent loss of error information
  • Tool runs locally, keeping data on disk, no data transmitted
  • Users approve commands before execution, adds security layer

How to Choose an Affordable Logging API for Small Projects — Three Silent-Run Tests

Short answer: Choose an affordable logging API for small projects by testing whether it can reconstruct a silent scheduled import, then match retention and search depth to that job.

  • Test logging API with skipped run, empty successful run, and failed parse
  • Emit four events: importstarted, importcompleted, importempty, importfailed
  • Retention windows of fourteen days may suffice for small projects

More from Tuesday 27 October →