resampleAudio
Resample PCM audio between sample rates.
Converts linear PCM from one sample rate to another, which realtime sessions need when a microphone's rate does not match what the provider expects.
let resampled = resampleAudio(samples, from: 48_000, to: 24_000)Signature
func resampleAudio(
_ input: [Float],
inputRate: Int,
outputRate: Int
) -> [Float]Defined in Sources/AI/Realtime/AudioResampling.swift.
Parameters
| Parameter | Type | Default |
|---|---|---|
_ | [Float] | required |
inputRate | Int | required |
outputRate | Int | required |
Overloads
1 other form of this function exists:
func resampleAudio(
_ input: Data,
inputRate: Int,
outputRate: Int
) -> DataReturns
The resampled samples.