Skip to content

Downsampler ​

Inherits: RefCounted

Description ​

Streams stereo audio frames down to mono 16 bit PCM at a lower sample rate.

Each output sample is the average of the input frames it covers (a box filter), which suppresses most of the aliasing that plain sample dropping causes. State is kept between calls so no frames are lost at chunk borders.

Properties ​

NameTypeDefault
_accfloat0.0
_countint0
_phasefloat0.0
ratiofloat

Methods ​

ReturnsName
void_init ( source_rate: float, target_rate: float )
Dictionaryprocess ( frames: PackedVector2Array )

Property Descriptions ​

_acc: float ​

No description provided yet.

_count: int ​

No description provided yet.

_phase: float ​

No description provided yet.

ratio: float ​

No description provided yet.

Method Descriptions ​

_init (source_rate: float , target_rate: float ) -> void ​

No description provided yet.

process (frames: PackedVector2Array ) -> Dictionary ​

Converts the given stereo frames. Returns little-endian signed 16 bit PCM and the peak absolute amplitude of the converted samples.