---
title: "How to Remove Background Noise from Video | Rendley API Docs"
description: "Strip music, room echo and background noise from a recording so only clean dialogue remains. Built for interviews, podcasts and field footage."
url: https://docs.rendley.com/api/examples/isolate-a-voice/
---

# Isolate a voice

Strip music, crowd noise, echo and hum so only speech remains. Useful before transcription, or to salvage audio from a location shoot.

The input can be audio or video. The output is always an MP3 audio track, so feeding in a video gives you back cleaned audio to lay over the original clip, not a new video.

## The flow

```
POST /v1/workspaces/{workspaceId}/library   ← upload the source file
POST /v1/ai/voice-isolation                  ← start the isolation job
GET  /v1/jobs/{id}                           ← poll until completed
```

Send `workspace_id` and the result lands in that workspace’s Library. Send `project_id` instead and it lands in that project’s uploads. Both are optional: omit them and the result goes to your Library, as long as the account has a single workspace.

## The script

The polling helpers used below

```
const API_KEY = "YOUR_API_KEY";
  const API = "https://api.rendley.com/v1";

  const headers = {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  };

  function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }

  // Generation and export jobs. The finished job carries output.url.
  async function waitForJob(jobId) {
    let job = { status: "queued" };

    while (job.status === "queued" || job.status === "processing") {
      await sleep(5000);

      const response = await fetch(`${API}/jobs/${jobId}`, { headers });

      if (!response.ok) {
        throw new Error("Job lookup failed: " + response.status);
      }

      job = (await response.json()).data;
      console.log("Job status:", job.status);
    }

    if (job.status !== "completed") {
      throw new Error("Job " + job.status + ": " + (job.error || ""));
    }

    return job;
  }

  // Agent jobs. The finished job carries project_id, thread_id and
  // last_message, but no output: export the project to get a file.
  // onPause answers an interactive run that stops to ask something.
  async function waitForAgentJob(jobId, onPause) {
    let job = { status: "pending" };

    while (job.status === "pending" || job.status === "running" || job.status === "waiting_input") {
      if (job.status === "waiting_input") {
        if (!onPause) throw new Error("The run is waiting for an answer");
        await onPause(job);
      }

      await sleep(5000);

      const response = await fetch(`${API}/agent/jobs/${jobId}`, { headers });

      if (!response.ok) {
        throw new Error("Job lookup failed: " + response.status);
      }

      job = (await response.json()).data;
      console.log("Edit status:", job.status);
    }

    if (job.status !== "completed") {
      throw new Error("The edit did not finish: " + (job.error || job.reason));
    }

    return job;
  }
```

```
import time
  import requests

  API_KEY = "YOUR_API_KEY"
  API = "https://api.rendley.com/v1"

  HEADERS = {"Authorization": f"Bearer {API_KEY}"}

  def wait_for_job(job_id):
      """Generation and export jobs. The finished job carries output.url."""
      job = {"status": "queued"}

      while job["status"] in ("queued", "processing"):
          time.sleep(5)

          response = requests.get(f"{API}/jobs/{job_id}", headers=HEADERS)
          response.raise_for_status()

          job = response.json()["data"]
          print("Job status:", job["status"])

      if job["status"] != "completed":
          raise RuntimeError(f"Job {job['status']}: {job.get('error', '')}")

      return job

  def wait_for_agent_job(job_id, on_pause=None):
      """Agent jobs. The finished job carries project_id, thread_id and
      last_message, but no output: export the project to get a file.

      on_pause answers an interactive run that stops to ask something.
      """
      job = {"status": "pending"}

      while job["status"] in ("pending", "running", "waiting_input"):
          if job["status"] == "waiting_input":
              if on_pause is None:
                  raise RuntimeError("The run is waiting for an answer")
              on_pause(job)

          time.sleep(5)

          response = requests.get(f"{API}/agent/jobs/{job_id}", headers=HEADERS)
          response.raise_for_status()

          job = response.json()["data"]
          print("Edit status:", job["status"])

      if job["status"] != "completed":
          raise RuntimeError("The edit did not finish: " + (job.get("error") or job.get("reason", "")))

      return job
```

```
import { readFile } from "node:fs/promises";
import { basename } from "node:path";

const SOURCE = "noisy-interview.mp4";

// Files live inside a workspace, so the upload needs one. An account
// always has at least one, and the first is the default.
async function firstWorkspaceId() {
  const response = await fetch(`${API}/workspaces`, { headers });

  if (!response.ok) {
    throw new Error("Could not list workspaces: " + response.status);
  }

  const body = await response.json();
  return body.data[0].id;
}

// Push the raw bytes into the media library. The response carries the
// file_hash the AI endpoints take as input.
async function upload(path, workspaceId) {
  const bytes = await readFile(path);

  const query = new URLSearchParams({
    file_name: basename(path),
    mime_type: "video/mp4",
  });

  const url = `${API}/workspaces/${workspaceId}/library?${query}`;

  const response = await fetch(url, {
    method: "POST",
    headers: {
      ...headers,
      "Content-Type": "application/octet-stream",
    },
    body: bytes,
  });

  if (!response.ok) {
    throw new Error("Upload failed: " + response.status);
  }

  const body = await response.json();
  return body.data;
}

// Start the isolation job. This returns straight away with a job id.
async function startIsolation(fileHash, workspaceId) {
  const response = await fetch(`${API}/ai/voice-isolation`, {
    method: "POST",
    headers: {
      ...headers,
      "Content-Type": "application/json",
    },
    // file_hash must be a library or project upload. A public URL is
    // not accepted here, so the upload above is required.
    body: JSON.stringify({
      workspace_id: workspaceId,
      params: { file_hash: fileHash },
    }),
  });

  if (!response.ok) {
    throw new Error("Could not start the job: " + response.status);
  }

  const body = await response.json();
  return body.data.job_id;
}

const workspaceId = await firstWorkspaceId();
const asset = await upload(SOURCE, workspaceId);

const jobId = await startIsolation(asset.file_hash, workspaceId);
const job = await waitForJob(jobId);

// The signed URL is the result. Fetch it, pipe it to your storage,
// or hand it to the browser.
console.log(job.output.url);
```

```
import os
import mimetypes
import requests

SOURCE = "noisy-interview.mp4"

def first_workspace_id():
    """Files live inside a workspace. An account always has at least one,
    and the first is the default."""
    response = requests.get(f"{API}/workspaces", headers=HEADERS)
    response.raise_for_status()

    return response.json()["data"][0]["id"]

def upload(path, workspace_id):
    """Push the raw bytes into the media library. The response carries the
    file_hash the AI endpoints take as input."""
    mime = mimetypes.guess_type(path)[0] or "application/octet-stream"

    with open(path, "rb") as f:
        response = requests.post(
            f"{API}/workspaces/{workspace_id}/library",
            headers={**HEADERS, "Content-Type": "application/octet-stream"},
            params={"file_name": os.path.basename(path), "mime_type": mime},
            data=f,
        )

    response.raise_for_status()

    return response.json()["data"]

def start_isolation(file_hash, workspace_id):
    """Start the isolation job. Returns straight away with a job id."""
    response = requests.post(
        f"{API}/ai/voice-isolation",
        headers=HEADERS,
        # file_hash must be a library or project upload. A public URL is
        # not accepted here, so the upload above is required.
        json={
            "workspace_id": workspace_id,
            "params": {"file_hash": file_hash},
        },
    )
    response.raise_for_status()

    return response.json()["data"]["job_id"]

workspace_id = first_workspace_id()
asset = upload(SOURCE, workspace_id)

job_id = start_isolation(asset["file_hash"], workspace_id)
job = wait_for_job(job_id)

# The signed URL is the result. Download it, or hand it straight to
# whatever consumes the audio next.
audio = requests.get(job["output"]["url"])

with open("clean-dialogue.mp3", "wb") as f:
    f.write(audio.content)

print("Saved clean-dialogue.mp3")
```

## When to use voice isolation

- **Before transcription**, cleaner audio produces more accurate transcripts and captions.
- **Podcast post-production**, remove echo and background hum from remote recordings.
- **Interview cleanup**, salvage on-location recordings with wind or crowd noise.
- **Content repurposing**, extract the dialogue from a video before re-scoring with new music.

[Previous pageUpscale a video](https://docs.rendley.com/api/examples/upscale-video/) [Next pageUsers](https://docs.rendley.com/api/users/)
