sendCustomAudioData abstract method
- TRTCAudioFrame frame
Deliver captured audio data to SDK
We recommend you enter the following information for the TRTCAudioFrame parameter (other fields can be left empty):
- audioFormat:
- Audio data format, which can only be TRTCAudioFrameFormat.pcm.
- data:
- Audio frame buffer. Audio frame data must be in PCM format,
and it supports a frame length of 5–100 ms (20 ms is recommended).
Length calculation method:
For example, if the sample rate is 48000, then the frame length
for mono channel will be
48000 * 0.02s * 1 * 16 bit = 15360 bit = 1920 bytes
.
- Audio frame buffer. Audio frame data must be in PCM format,
and it supports a frame length of 5–100 ms (20 ms is recommended).
Length calculation method:
For example, if the sample rate is 48000, then the frame length
for mono channel will be
- sampleRate:
- Sample rate. Valid values: 16000, 24000, 32000, 44100, 48000.
- channel:
- Number of channels (if stereo is used, data is interwoven).
- Valid values: 1: mono channel; 2: dual channel.
- timestamp (ms):
Parameters:
- frame(TRTCAudioFrame):
- Audio data.
Note:
- Please call this API accurately at intervals of the frame length; otherwise, sound lag may occur due to uneven data delivery intervals.
Implementation
void sendCustomAudioData(TRTCAudioFrame frame);