AudioParams

Audio data format.

public class AudioParams
    {
        public int sample_rate { set; get; }
        public int channels { set; get; }
        public RAW_AUDIO_FRAME_OP_MODE_TYPE mode { set; get; }
        public int samples_per_call { set; get; }

        public AudioParams()
        {
            sample_rate = 0;
            channels = 0;
            mode = RAW_AUDIO_FRAME_OP_MODE_TYPE.RAW_AUDIO_FRAME_OP_MODE_READ_ONLY;
            samples_per_call = 0;
        }

        public AudioParams(int samplerate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE type, int samplesPerCall)
        {
            sample_rate = samplerate;
            channels = channel;
            mode = type;
            samples_per_call = samplesPerCall;
        }
    };
You can pass an AudioParams object in the following APIs to set the audio data format for the corresponding callback:
Note:

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 RAW_AUDIO_FRAME_OP_MODE_TYPE.
samples_per_call
Number of samples per call. Typically 1024 in scenarios like media stream relay.