Expand description
What the device delivers, turned into the mono model-rate signal.
Re-exportsΒ§
use rubato::Resampler as _;πuse rubato::audioadapter_buffers::direct::SequentialSliceOfSlices;πuse rubato::audioadapter_buffers::direct::SequentialSliceOfVecs;πuse crate::Error;πuse crate::SAMPLE_RATE;π
StructsΒ§
- Input
Converter π - Turns what the device delivers into the mono
SAMPLE_RATEsignal everything downstream reads. Pass-through when the device natively offers the model rate; otherwise downmix to mono, then resample with a windowed-sinc filter. Decimating without the filter would fold everything above the new Nyquist into the speech band as confident wrong words. - Resampling π
ConstantsΒ§
- RESAMPLE_
CHUNK π - Resampler input per call, in device frames. 10 ms at 48 kHz; any block size the device delivers is staged up to it.
FunctionsΒ§
- channel_
mean π - Mean of one interleaved frame, so every channel contributes. Discarding a capsule silently halves the signal on hardware where the speaker sits nearer one of them.
- raw_
peak π - The loudest absolute sample of a raw block, before any downmix: a meter should show a channel clipping even where the mono mix halves it.
- resample_
mono - A buffer of mono audio at
from, converted totowith the input pathβs own filter. The same rate hands the buffer straight back. - sinc_
parameters π - The windowed-sinc filter both resampling paths use:
f_cutoffis relative to the lower of the two Nyquists, so speech below it passes and everything that would alias is in the stopband.