Estimate audio duration after trimming silence
Estimate the final running time of an audio clip before you perform an edit. Provide the clip's total duration and the start and end time of every detected silence segment.
Run — free
The calculator validates the timeline, combines intervals that overlap or touch, and subtracts the unique silent time only once. It returns the original duration, removable silence, estimated resulting duration, and useful segment counts. This makes it practical for planning podcast edits, voice recording cleanup, lecture processing, and batch media workflows without uploading or decoding the audio itself.
Prepare a reliable silence timeline
Start with the total duration of the audio clip in seconds, then provide each detected silence interval with a start and an end time measured from the beginning of that same clip. Decimal values are welcome, so a detector result such as 12.375 to 14.8 seconds can be used directly. Keep every interval on one consistent timeline; do not mix sample positions, milliseconds, timecodes, or values taken from separately cut versions of the recording. A segment may begin at zero or end exactly at the total duration. A zero-length segment is valid but removes no time. Negative boundaries and reversed intervals are rejected because they cannot represent elapsed time. Most importantly, an interval ending after the clip duration produces an input error instead of an optimistic estimate. That validation catches a common batch-processing mistake in which silence detections from one file are accidentally paired with the duration of another. The calculator works only with supplied timing data and never needs the audio file itself.
Understand overlap-safe subtraction
Silence detectors can report intervals that overlap, nest inside one another, or meet at the same boundary. Simply adding every segment length would count shared time more than once and make the predicted output too short. This calculator sorts the intervals and merges their covered ranges before subtracting anything. For example, silence from 10 to 15 seconds and from 14 to 18 seconds covers eight unique seconds, not nine. A smaller interval entirely contained in a larger one adds no further trimmed time. Touching intervals, such as 20 to 22 and 22 to 24, are also combined because there is no retained audio between them. The returned trimmed duration is therefore the union of all non-empty silence ranges. The resulting duration is the original total minus that union. Input segment count reports how many records you supplied, while merged segment count reports how many distinct removable ranges remain after consolidation. Those counts help explain why the arithmetic may differ from a naive sum.
Use the estimate in an editing workflow
Treat the result as a timeline estimate for a specific trimming rule: every supplied silence interval is removed completely, with no padding retained around speech. If your production tool preserves handles, applies fades, enforces a minimum silence length, or shifts boundaries for breath sounds, adjust the detected intervals before sending them or expect the rendered file to differ. The calculation is especially useful before expensive media processing. A podcast pipeline can estimate episode length, a transcription workflow can forecast the amount of audio remaining, and an upload service can compare a cleaned recording with a duration limit. Store the original duration and detector settings alongside the request so the estimate remains auditable. Because the algorithm is deterministic, identical numeric inputs always produce identical output. It performs no network calls, decoding, resampling, or acoustic analysis. The API request costs $0.002; the returned values describe seconds and can be converted to display timecodes by your application without changing the underlying estimate.
What you can do with it
Plan a podcast edit
Estimate the episode length after removing detected pauses before launching a full audio render.
Forecast transcription volume
Calculate how much timed audio remains when silence is excluded from a speech-processing batch.
Check a duration target
Determine whether a cleaned lecture, interview, or voice recording is likely to fit a publishing limit.
FAQ
What does a request cost?
Each API request costs $0.002.
What unit should I use?
Use seconds for the total duration and every segment boundary. Decimal seconds are supported.
What happens when silence segments overlap?
Overlapping, nested, and touching intervals are merged, so the same portion of audio is never subtracted twice.
Does this capability detect silence in an audio file?
No. It calculates from silence segments you already detected and does not upload, decode, or analyze audio.
What happens if a segment exceeds the clip duration?
The request returns an invalid input error when any segment end is greater than total_duration.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/audio/audio-silence-trim-estimate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"total_duration":120,"silence_segments":[{"start":0,"end":3.5},{"start":42,"end":47.25},{"start":110,"end":120}]}'const res = await fetch("https://api.kit.forhosting.com/audio/audio-silence-trim-estimate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"total_duration": 120,
"silence_segments": [
{
"start": 0,
"end": 3.5
},
{
"start": 42,
"end": 47.25
},
{
"start": 110,
"end": 120
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/audio/audio-silence-trim-estimate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"total_duration": 120,
"silence_segments": [
{
"start": 0,
"end": 3.5
},
{
"start": 42,
"end": 47.25
},
{
"start": 110,
"end": 120
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/audio/audio-silence-trim-estimate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"total_duration":120,"silence_segments":[{"start":0,"end":3.5},{"start":42,"end":47.25},{"start":110,"end":120}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"total_duration":120,"silence_segments":[{"start":0,"end":3.5},{"start":42,"end":47.25},{"start":110,"end":120}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/audio/audio-silence-trim-estimate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"total_duration": 120,
"silence_segments": [
{
"start": 0,
"end": 3.5
},
{
"start": 42,
"end": 47.25
},
{
"start": 110,
"end": 120
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "audio.audio_silence_trim_estimate",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 200 |
max_minutes | 180 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |