Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink DataFrame
  • PyFlink Multimodal
    • Image
    • Video
    • Audio
    • Utilities
  • PyFlink Table
  • PyFlink DataStream
  • PyFlink Common

pyflink.multimodal.operators.audio_resample#

audio_resample(*columns, sample_rate, concurrency=None)[source]#

Resample an audio waveform.

This changes the sample rate while preserving the channel count. Use audio_standardize when both sample rate and channel layout should be normalized.

Parameters
  • *columns – Optional audio columns. Supported input is AUDIO_WAVEFORM only; call audio_decode first for encoded inputs.

  • sample_rate – Target sample rate in samples per second.

  • concurrency – UDF concurrency. None uses the framework default.

Returns

A UDF producing ROW<data TENSOR('float32'), sample_rate INT, channels INT, frames BIGINT, sample_format STRING, layout STRING, duration_ms BIGINT, source_uri STRING, start_time_ms BIGINT, end_time_ms BIGINT>.

Raises

ValueError – If the input is not an audio waveform row, or if sample_rate is invalid.

Examples::
>>> # Usage 1: create a reusable UDF and apply it to a column.
>>> resample = audio_resample(sample_rate=8000)
>>> df = df.with_column("resampled", resample(col("waveform")))
>>>
>>> # Usage 2: pass the column directly when building the expression.
>>> df = df.with_column(
...     "resampled",
...     audio_resample(col("waveform"), sample_rate=8000),
... )

previous

pyflink.multimodal.operators.audio_standardize

next

pyflink.multimodal.operators.audio_split_by_duration

Show Source

Created using Sphinx 4.5.0.