cutcutcodec.core.analysis.stream.rate_audio

Smartly choose the framerate of an audio stream.

Functions

optimal_rate_audio(stream[, t_min, t_max])

Find the optimal sampling rate for a given audio stream.

Details

cutcutcodec.core.analysis.stream.rate_audio.optimal_rate_audio(stream: StreamAudio, t_min: Fraction | None = None, t_max: Fraction | float | None = None) int[source]

Find the optimal sampling rate for a given audio stream.

Parameters

streamcutcutcodec.core.classes.stream_audio.StreamAudio

The audio stream that we want to find the optimal rate.

t_minfloat, optional

The lower bound of the time slice estimation.

t_maxfloat, optional

The higher bound of the time slice estimation.

Returns

framerateint

The minimum samplerate that respects the Nyquist–Shannon theorem. The special value 0 is returned if not special rate is suggested.