AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Integrating Cleanvoice API (v2) in Python: Automating Podcast Filler Word Removal and Loudness Normalization

Dan Budington · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Audio engineering teams and podcast platform developers frequently face an operational bottleneck: scaling post-production across hundreds of weekly episodes without ballooning studio labor costs. Relying on manual editing in desktop digital audio workstations (DAWs) or interacting with browser-based dashboards introduces severe latency, inconsistent acoustic quality, and human error. When handling high-concurrency ingestion pipelines, programmatic batch automation is the only viable solution.

At 365Finds, our assessment is unequivocal: engineering teams must decouple audio processing from synchronous web threads. For robust production pipelines, we strongly recommend deploying the Cleanvoice API (v2) via its official Python SDK (cleanvoice-sdk), pairing decoupled task scheduling (create_edit) with cloud-native direct-to-storage delivery (signed_url). This approach eliminates server-side bandwidth exhaustion, guarantees deterministic loudness calibration to industry standards (-16 LUFS), and provides surgical speech defect removal without sacrificing conversational cadence.


Architecture Overview & Authentication

Cleanvoice API v2 operates on European, ISO 27001-certified cloud infrastructure. It processes speech by executing neural acoustic filtering across resampled 44.1 kHz or 48 kHz audio buffers. While raw HTTP requests interact directly with the REST endpoints using an X-API-Key header, the official cleanvoice-sdk abstracts transport semantics, upload signatures, and polling mechanics.

Installation and Credentials

Install the native package using pip or modern packaging tools such as uv:

pip install cleanvoice-sdk

Secure authentication requires exposing your credentials via an environment variable. Cleanvoice automatically inspects the environment for CLEANVOICE_API_KEY:

export CLEANVOICE_API_KEY="your_production_api_key"

Verify connectivity and remaining balance using the client interface:

import os
from cleanvoice import Cleanvoice

# Initialize from environment variable
client = Cleanvoice.from_env()

# Validate account access and inspect available hours
account = client.check_auth()
print(f"Authenticated successfully. Total credit: {account.get('credit', {}).get('total')} hours")

Configuring Acoustic Boolean Filters and Loudness Standards

The Cleanvoice v2 engine relies on explicit configuration flags to apply neural isolation, surgical cutting, and mastering curves. Audio engineers must balance aggressive artifact removal against unnatural speech cadence.

Core Parameter Specification

ParameterTypeDefaultOperational Impact
fillersboolFalseRemoves vocalized hesitations (um, uh, like, you know) across 20+ supported languages.
mouth_soundsboolFalseDetects and eliminates salivation clicks, lip smacks, and swallowing transients.
stuttersboolFalseTrims false starts and repeated syllable fragments.
breathbool | strFalseControls breath sounds. Accepts True (standard removal), "legacy" (conservative cut for pristine studio sources), or "natural" (attenuation instead of complete silence).
long_silencesboolFalseTruncates dead air while preserving conversational pacing.
mutedboolFalseSilences detected defects rather than splicing audio out. Essential for video workflows or multi-track sync.
remove_noisebool | strTrueInvokes the Noise v2 neural model. Passing "legacy" pins DeepFilterNet.
studio_soundbool | strFalseApplies neural de-reverberation, frequency balancing, and room resonance correction.
normalizeboolFalseEnables Normalize v2 for dynamic range leveling and peak control.
target_lufsfloat-16.0Sets the integrated loudness target (valid range: -36.0 to -6.0 LUFS). -16.0 LUFS represents the podcast broadcast standard.
mute_lufsfloat-120.0Gating threshold for loudness measurement (-120.0 disables gating).

365Finds Recommended Acoustic Profiles

  1. Standard Conversational Podcast: Enable fillers=True, mouth_sounds=True, breath="natural", remove_noise=True, normalize=True, and target_lufs=-16.0. This preserves human warmth while eliminating annoying mic-proximity artifacts.
  2. Dense Technical Monologue or Audiobooks: Enable fillers=True, stutters=True, long_silences=True, breath=True, studio_sound=True, and normalize=True. This tightens pacing and maximizes intelligibility.
  3. Multi-Track or Video Dialogue: Always set muted=True. Splicing audio files changes file duration, instantly throwing video lipsync or multitrack phase alignment out of sync. Using muted=True attenuates defects in place, ensuring millisecond-exact duration parity.

Synchronous Single-Track Workflow (client.process)

For ad-hoc scripts, CLI tools, or batch processing runs where a blocking thread is permissible, the high-level client.process() method manages the complete lifecycle: uploading local files, triggering the job, polling status, and downloading the finalized asset.

from cleanvoice import Cleanvoice

client = Cleanvoice.from_env()

# Synchronously clean and normalize a spoken audio track
result = client.process(
    "input_interview.wav",
    fillers=True,
    mouth_sounds=True,
    breath="natural",
    long_silences=True,
    remove_noise=True,
    normalize=True,
    target_lufs=-16.0,
    export_format="mp3",
    output_path="mastered_interview.mp3"
)

print(f"Processing Complete. Remote URI: {result.audio.url}")
print(f"Mastered asset saved locally at: {result.audio.local_path}")

While convenient for local scripting, client.process() blocks worker threads for 30 to 600 seconds depending on asset duration. In production environments, this pattern invites connection timeouts and idle worker waste.


Decoupled Asynchronous Production Pipelines (Celery / Distributed Tasks)

For media platforms processing continuous ingest streams, audio engineers must adopt an asynchronous job state machine. This decouples job dispatch (client.create_edit) from status inspection (client.get_edit), allowing backend workers to scale independently.

The Job Lifecycle State Machine

A Cleanvoice job advances through deterministic stages:

PENDING → PREPROCESSING → CLASSIFICATION → EDITING → POSTPROCESSING → EXPORT → SUCCESS
                                                                             ↘ FAILURE
                                                                             ↗ RETRY

Implementing a Distributed Celery Task

The following code illustrates how to submit an edit asynchronously, queue an inspection loop with exponential backoff, and handle downstream ingestion:

import time
from celery import shared_task
from cleanvoice import Cleanvoice

@shared_task(bind=True, max_retries=3, default_retry_delay=60)
def submit_cleanvoice_pipeline(self, audio_url: str, output_storage_key: str):
    """
    Submits a podcast edit job and dispatches the polling task.
    """
    client = Cleanvoice.from_env()
    
    try:
        # Non-blocking job dispatch
        edit_id = client.create_edit(
            audio_url,
            fillers=True,
            mouth_sounds=True,
            stutters=True,
            breath="natural",
            remove_noise=True,
            normalize=True,
            target_lufs=-16.0,
            export_format="mp3"
        )
        
        # Dispatch asynchronous status polling
        poll_cleanvoice_edit.apply_async(args=[edit_id, output_storage_key], countdown=15)
        return {"status": "SUBMITTED", "edit_id": edit_id}
        
    except Exception as exc:
        raise self.retry(exc=exc)


@shared_task(bind=True, max_retries=60, default_retry_delay=10)
def poll_cleanvoice_edit(self, edit_id: str, output_storage_key: str):
    """
    Polls the edit status until terminal SUCCESS or FAILURE.
    """
    client = Cleanvoice.from_env()
    edit = client.get_edit(edit_id)
    status = edit.status

    if status == "SUCCESS":
        download_url = edit.result.download_url
        # Trigger downstream download, transcode, or database update
        return {
            "status": "COMPLETED",
            "edit_id": edit_id,
            "download_url": download_url
        }
    
    elif status in ["PENDING", "PREPROCESSING", "CLASSIFICATION", "EDITING", "POSTPROCESSING", "EXPORT"]:
        # Re-queue check in 10 seconds
        raise self.retry(countdown=10)
        
    elif status == "RETRY":
        raise self.retry(countdown=30)
        
    elif status == "FAILURE":
        raise RuntimeError(f"Cleanvoice edit job {edit_id} failed permanently.")
        
    else:
        raise ValueError(f"Unknown status received: {status}")

Cloud Scalability: Direct-to-Storage Ingestion (signed_url)

In conventional pipelines, processed media flows from Cleanvoice's servers back to your application server, and then to your private Amazon S3 or Google Cloud Storage bucket. This double-hop architecture inflates egress bandwidth fees and congests application memory.

Cleanvoice v2 solves this via the signed_url parameter. By providing a pre-signed S3 PUT URL, Cleanvoice uploads the finalized, normalized master directly into your object storage bucket. Your application server never handles the heavy binary payload.

import boto3
from cleanvoice import Cleanvoice

def execute_zero_egress_clean(audio_source_url: str, s3_bucket: str, destination_key: str):
    client = Cleanvoice.from_env()
    s3_client = boto3.client("s3")

    # Generate an Amazon S3 pre-signed PUT URL valid for 2 hours
    presigned_put_url = s3_client.generate_presigned_url(
        ClientMethod="put_object",
        Params={
            "Bucket": s3_bucket,
            "Key": destination_key,
            "ContentType": "audio/mpeg"
        },
        ExpiresIn=7200
    )

    # Cleanvoice directly streams the cleaned result to your S3 bucket
    edit_id = client.create_edit(
        audio_source_url,
        fillers=True,
        mouth_sounds=True,
        breath="natural",
        normalize=True,
        target_lufs=-16.0,
        signed_url=presigned_put_url,
        export_format="mp3"
    )

    return edit_id

Engineering Tip: Ensure the presigned URL expiration (ExpiresIn) is set to at least 3,600 seconds (1 hour). High-duration audio files (e.g., 2-hour multi-mic interviews) require 10 to 15 minutes of compute before the HTTP PUT request is initiated.


Extracting Transcripts, Chapters, and AI Metadata

Cleanvoice v2 unifies acoustic post-processing with speech intelligence. Setting transcription=True leverages automated Whisper speech recognition (covering 99 languages), while summarize=True generates structured chapters and executive show notes without requiring extra LLM calls.

from cleanvoice import Cleanvoice

client = Cleanvoice.from_env()

result = client.process(
    "tech_briefing.mp3",
    fillers=True,
    normalize=True,
    transcription=True,
    summarize=True,
    social_content=True
)

# Accessing Cleaned Audio
print("Audio Location:", result.audio.url)

# Accessing Structured Transcription
print("Full Transcript Text:\n", result.transcript.text)

# Accessing Chapter Markers for Podcast Show Notes
print("\nGenerated Chapters:")
for chapter in result.summarization.chapters:
    print(f"[{chapter['start']:.2f}s] {chapter['title']}")

# Accessing Key Learnings and Social Snippets
print("\nExecutive Summary:", result.summarization.summary)
print("\nNewsletter Copy:\n", result.social_content.newsletter)

Architectural Decision Matrix & Production Practices

Architecture PatternLatency ProfileWorker LoadBest Suited For
Blocking client.process()High (synchronous wait)High (thread locked)Ad-hoc CLI tools; development prototypes; batch scripts with low file counts.
Asynchronous Worker (create_edit + Polling)Low (non-blocking)Minimal (light polling)High-volume podcast ingestion; automated CMS post-processing platforms.
Direct S3 Integration (signed_url)Optimal (zero server hop)Lowest (pure orchestration)Enterprise platforms; heavy media pipelines seeking bandwidth cost reduction.
Video Demux-Enhance-MuxMedium (local FFmpeg)Efficient (tiny audio payload)Video podcasts where speech enhancement is required without visual cuts.

365Finds Operational Rules for Engineers

By integrating Cleanvoice API v2 using asynchronous task workers and direct S3 delivery, engineering organizations transform complex, artist-dependent audio post-production into an automated, predictable, and master-quality software pipeline.


References