IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

AudioGenerationDetails

AudioGenerationDetails

class max.pipelines.request.AudioGenerationDetails(*, duration_seconds, sample_rate, channels, num_samples, steps)

source

Bases: BaseModel

Audio generation usage metadata.

The audio counterpart of ImageGenerationDetails: what a caller would need to attribute usage, taken from the audio that was actually produced rather than from what the request asked for, since a model may stop before the duration it was given.

Parameters:

  • duration_seconds (float)
  • sample_rate (int)
  • channels (int)
  • num_samples (int)
  • steps (int)

channels

channels: int

source

duration_seconds

duration_seconds: float

source

from_waveform()

classmethod from_waveform(waveform, *, sample_rate, steps)

source

Build audio generation details from a generated waveform.

Parameters:

  • waveform (ndarray[tuple[Any, ...], dtype[float32]]) – The generated samples, shaped (channels, samples).
  • sample_rate (int) – Sample rate of the waveform, in hertz.
  • steps (int) – The number of denoising steps used to generate.

Returns:

An AudioGenerationDetails describing the generated audio.

Raises:

ValueError – If the waveform is not two-dimensional, or the sample rate is not positive.

Return type:

AudioGenerationDetails

model_config

model_config: ClassVar[ConfigDict] = {'frozen': True}

source

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_samples

num_samples: int

source

sample_rate

sample_rate: int

source

steps

steps: int

source