﻿# Stable Audio duration: timing conditioning and returned cropping are separate operations

Follow Stable Audio Open timing inputs through duration embeddings, fixed latent preparation, waveform decoding, and cropping before estimating work from returned audio length.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-stable-audio-duration-conditioning-fixed-latents/
Language: en

## Specify the concrete generation pipeline

The [Stable Audio Open card](https://huggingface.co/stabilityai/stable-audio-open-1.0) identifies a text-to-audio release with an autoencoding and diffusion generation path. This guide examines the Diffusers implementation for that family rather than assuming all audio generators use the same duration mechanism. A requested duration can influence model conditioning, returned waveform selection, and internal work in different ways. Those effects should be investigated separately before writing scheduling or pricing assumptions into a service.

## Treat timing as model input

The [pipeline documentation](https://huggingface.co/docs/diffusers/api/pipelines/stable_audio) exposes `audio_start_in_s` and `audio_end_in_s`. In the [implementation](https://raw.githubusercontent.com/huggingface/diffusers/main/src/diffusers/pipelines/stable_audio/pipeline_stable_audio.py), duration encoding projects the start and end values into hidden states supplied to the transformer together with text information. Therefore, requesting a shorter output is not merely an external file-editing operation. Changing the timing conditions can change generation itself even before decoded audio is sliced for return.

## Inspect allocated latent length

The examined implementation prepares latent variables using the transformer configuration sample size, then decodes and crops the waveform to the requested interval. Consequently, returned duration alone is not evidence that the denoising loop processed a proportionally smaller latent sequence. This describes the reviewed path, not an immutable restriction on every future optimized implementation. Check the installed revision and actual tensor shapes when estimating GPU work or comparing it with another implementation that might explicitly use variable-size generation.

## Investigate a short-effect workload

Suppose an application requests brief interface sounds and expects runtime to scale directly with the final file length. Profile text encoding, duration encoding, latent denoising, decoding, and output cropping separately. If the generated latent shape remains unchanged, a shorter returned file can coexist with similar transformer work. Compare controlled prompts and seeds while recording timing conditions. This test avoids attributing all runtime variation to requested duration or assuming that cropping a longer generation afterward reproduces a separately conditioned short generation.

## Report both requested and executed sizes

Record requested interval, effective latent shape, model revision, scheduler settings, decoded waveform length, and returned sample count. Guides to [diffusion objectives](/journal/diffusion-forward-noise-training-target/) and [inference evaluation](/journal/inference-benchmark-method/) support interpretation. Measure the actual configured path before deriving throughput from output seconds. A useful benchmark exposes where timing enters the model and where length is enforced on the result, so file duration remains a user-facing outcome rather than an unverified proxy for neural computation.
