AudioParams
Audio data format.
export class AudioParams {
sample_rate?: number;
channels?: number;
mode?: RawAudioFrameOpModeType;
samples_per_call?: number;
}
The SDK sets the audio data format in the following callbacks based on AudioParams:
Note:
- The SDK calculates the sampling interval using the
samplesPerCall,sampleRate, andchannelparameters in AudioParams, and triggers the onRecordAudioFrame, onPlaybackAudioFrame, onMixedAudioFrame, and onEarMonitoringAudioFrame callbacks accordingly. - Sampling interval =
samplesPerCall/ (sampleRate×channel). - Ensure the sampling interval is not less than 0.01 (s).
Properties
- sample_rate
- Sampling rate of the data in Hz. Valid values:
- 8000
- 16000 (default)
- 32000
- 44100
- 48000
- channels
- Number of audio channels. Valid values:
- 1: Mono (default)
- 2: Stereo
- mode
- Usage mode of the data. See RawAudioFrameOpModeType.
- samples_per_call
- Number of samples per call, typically 1024 in scenarios like CDN streaming.