AudioParams
Audio data format.
class AudioParams {
const AudioParams(
{this.sampleRate, this.channels, this.mode, this.samplesPerCall});
@JsonKey(name: 'sample_rate')
final int? sampleRate;
@JsonKey(name: 'channels')
final int? channels;
@JsonKey(name: 'mode')
final RawAudioFrameOpModeType? mode;
@JsonKey(name: 'samples_per_call')
final int? samplesPerCall;
factory AudioParams.fromJson(Map<String, dynamic> json) =>
_$AudioParamsFromJson(json);
Map<String, dynamic> toJson() => _$AudioParamsToJson(this);
}
Note:
- The SDK calculates the sampling interval based on the
samplesPerCall,sampleRate, andchannelparameters in AudioParams, and triggers the onRecordAudioFrame, onPlaybackAudioFrame, onMixedAudioFrame, and onEarMonitoringAudioFrame callbacks accordingly. - Sampling interval =
samplesPerCall/ (sampleRate×channel). - Make sure the sampling interval is not less than 0.01 (s).
Properties
- sampleRate
- Sampling rate of the data in Hz. The possible values are:
- 8000
- 16000 (default)
- 32000
- 44100
- 48000
- channels
- Number of audio channels. The possible values are:
- 1: Mono (default)
- 2: Stereo
- mode
- Usage mode of the data. See RawAudioFrameOpModeType.
- samplesPerCall
- Number of audio samples per call, typically 1024 in scenarios like media stream relay.