This document provides a reference for the main classes and methods of the Agora Server SDK Java API.
- Core Classes
- Observer Interfaces
- Data Structures
- AgoraServiceConfig
- RtcConnConfig
- RtcConnPublishConfig
- RtcConnInfo
- VideoEncoderConfig
- VideoSubscriptionOptions
- SimulcastStreamConfig
- EncodedVideoFrameInfo
- EncodedAudioFrameInfo
- EncodedAudioFrameReceiverInfo
- SenderOptions
- VideoFrame
- AudioFrame
- ExternalVideoFrame
- VideoDimensions
- RtcStats
- UserInfo
- VadProcessResult
- AgoraAudioVadConfigV2
- LocalAudioTrackStats
- LocalVideoTrackStats
- RemoteAudioTrackStats
- RemoteVideoTrackStats
- EncryptionConfig
- UplinkNetworkInfo
- DownlinkNetworkInfo
- PeerDownlinkInfo
- AgoraApmConfig
- AinsConfig
- AIAecConfig
- BghvsConfig (apm)
- AgcConfig (apm)
- Utility Classes
The AgoraService class is the entry point of the Agora Server SDK. It provides the main methods for initializing and managing the SDK.
Gets the SDK version.
- Returns:
String- The SDK version.
Initializes the Agora service with the specified configuration.
- Parameters:
config:AgoraServiceConfig- The configuration for the Agora service.
- Returns:
int- 0 for success, < 0 for failure.
Destroys the Agora service and releases all resources.
Sets the log file path and size.
- Parameters:
filePath:String- The path of the log file.fileSize:int- The maximum size of the log file in bytes.
- Returns:
int- 0 for success, < 0 for failure.
Sets the log filter level.
- Parameters:
filters:int- The log filter level.
- Returns:
int- 0 for success, < 0 for failure.
Creates an AgoraRtcConn object.
- Parameters:
rtcConnConfig:RtcConnConfig- The configuration for the RTC connection.
- Returns:
AgoraRtcConn- The createdAgoraRtcConnobject.
Gets the AgoraParameter object for setting SDK parameters.
- Returns:
AgoraParameter- TheAgoraParameterobject.
The AgoraRtcConn class represents an RTC connection.
Destroys the AgoraRtcConn instance and releases all associated resources.
Registers an IRtcConnObserver to receive connection-related events.
- Parameters:
observer:IRtcConnObserver- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
Registers an INetworkObserver to receive network-related events.
- Parameters:
observer:INetworkObserver- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
registerAudioFrameObserver(IAudioFrameObserver observer, boolean enableVad, AgoraAudioVadConfigV2 vadConfig)
Registers an IAudioFrameObserver to receive raw audio data.
- Parameters:
observer:IAudioFrameObserver- The observer to register.enableVad:boolean- Whether to enable Voice Activity Detection (VAD).vadConfig:AgoraAudioVadConfigV2- The configuration for VAD.
- Returns:
int- 0 for success, < 0 for failure.
Registers an IAudioEncodedFrameObserver to receive encoded audio frames.
- Parameters:
observer:IAudioEncodedFrameObserver- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
Registers an ILocalUserObserver to receive events for the local user.
- Parameters:
observer:ILocalUserObserver- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
Registers an IVideoFrameObserver2 to receive raw video frames.
- Parameters:
agoraVideoFrameObserver2:AgoraVideoFrameObserver2- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
Registers an IVideoEncodedFrameObserver to receive encoded video frames.
- Parameters:
agoraVideoEncodedFrameObserver:AgoraVideoEncodedFrameObserver- The observer to register.
- Returns:
int- 0 for success, < 0 for failure.
Connects to a channel.
- Parameters:
token:String- The token for authentication.channelId:String- The channel ID.userId:String- The user ID.
- Returns:
int- 0 for success, < 0 for failure.
Disconnects from the channel.
- Returns:
int- 0 for success, < 0 for failure.
Gets the AgoraLocalUser object associated with this connection.
- Returns:
AgoraLocalUser- The local user object.
The AgoraLocalUser class provides methods to manage the local user's audio and video.
Publishes a local audio track.
- Parameters:
agoraLocalAudioTrack:AgoraLocalAudioTrack- The local audio track to publish.
- Returns:
int- 0 for success, < 0 for failure.
Unpublishes a local audio track.
- Parameters:
agoraLocalAudioTrack:AgoraLocalAudioTrack- The local audio track to unpublish.
- Returns:
int- 0 for success, < 0 for failure.
Publishes a local video track.
- Parameters:
agoraLocalVideoTrack:AgoraLocalVideoTrack- The local video track to publish.
- Returns:
int- 0 for success, < 0 for failure.
Unpublishes a local video track.
- Parameters:
agoraLocalVideoTrack:AgoraLocalVideoTrack- The local video track to unpublish.
- Returns:
int- 0 for success, < 0 for failure.
Subscribes to a remote user's audio track.
- Parameters:
userId:String- The ID of the remote user.
- Returns:
int- 0 for success, < 0 for failure.
Unsubscribes from a remote user's audio track.
- Parameters:
userId:String- The ID of the remote user.
- Returns:
int- 0 for success, < 0 for failure.
Subscribes to a remote user's video track.
- Parameters:
userId:String- The ID of the remote user.options:VideoSubscriptionOptions- The subscription options.
- Returns:
int- 0 for success, < 0 for failure.
Unsubscribes from a remote user's video track.
- Parameters:
userId:String- The ID of the remote user.
- Returns:
int- 0 for success, < 0 for failure.
The AgoraParameter class provides methods to set and get SDK parameters.
Destroys the AgoraParameter object.
Sets an integer parameter.
- Parameters:
key:String- The key of the parameter.value:int- The integer value to set.
- Returns:
int- 0 on success, <0 on failure.
Sets a boolean parameter.
- Parameters:
key:String- The key of the parameter.value:boolean- The boolean value to set.
- Returns:
int- 0 on success, <0 on failure.
Sets an unsigned integer parameter.
- Parameters:
key:String- The key of the parameter.value:int- The unsigned integer value to set.
- Returns:
int- 0 on success, <0 on failure.
Sets a numeric parameter.
- Parameters:
key:String- The key of the parameter.value:double- The numeric value to set.
- Returns:
int- 0 on success, <0 on failure.
Sets a string parameter.
- Parameters:
key:String- The key of the parameter.value:String- The string value to set.
- Returns:
int- 0 on success, <0 on failure.
Sets an array parameter using a JSON string.
- Parameters:
key:String- The key of the parameter.json_src:String- The JSON string representing the array.
- Returns:
int- 0 on success, <0 on failure.
Sets multiple parameters using a JSON string.
- Parameters:
json_src:String- The JSON string containing multiple parameters.
- Returns:
int- 0 on success, <0 on failure.
Gets an integer parameter.
- Parameters:
key:String- The key of the parameter.value:Out- An Out object to store the integer value.
- Returns:
int- 0 on success, <0 on failure.
Gets a boolean parameter.
- Parameters:
key:String- The key of the parameter.value:Out- An Out object to store the boolean value.
- Returns:
int- 0 on success, <0 on failure.
Gets an unsigned integer parameter.
- Parameters:
key:String- The key of the parameter.value:Out- An Out object to store the unsigned integer value.
- Returns:
int- 0 on success, <0 on failure.
Gets a numeric parameter.
- Parameters:
key:String- The key of the parameter.value:Out- An Out object to store the numeric value.
- Returns:
int- 0 on success, <0 on failure.
Gets a string parameter.
- Parameters:
key:String- The key of the parameter.value:Out- An Out object to store the string value.
- Returns:
int- 0 on success, <0 on failure.
The AgoraExternalAudioProcessor class is used for Local Mode APM (Audio Processing Module), supporting VAD (Voice Activity Detection) and audio processing features (3A + BGHVS) without joining a channel.
create(AgoraService agoraService, AgoraAudioVadConfigV2 vadConfig, AgoraApmConfig apmConfig, IExternalAudioProcessorObserver observer)
Creates an external audio processor instance.
- Parameters:
agoraService:AgoraService- The AgoraService instance.vadConfig:AgoraAudioVadConfigV2- VAD configuration. If null, VAD is disabled.apmConfig:AgoraApmConfig- APM configuration. If null, 3A+BGHVS is disabled, only VAD is used.observer:IExternalAudioProcessorObserver- The observer for receiving processed audio frames.
- Returns:
AgoraExternalAudioProcessor- The created instance, or null on failure.
Pushes PCM audio data for processing.
- Parameters:
pcmData:byte[]- The PCM audio data.sampleRate:int- The sample rate (e.g., 16000).numOfChannels:int- The number of channels (e.g., 1 for mono).presentationMs:long- The presentation timestamp in milliseconds.
- Returns:
int- 0 for success, < 0 for failure.
Destroys the audio processor instance and releases all resources.
The observer interface for RTC connection events.
Occurs when the SDK connects to the Agora channel.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.connInfo:RtcConnInfo- Connection information.reason:int- The reason for the state change.
Occurs when the SDK disconnects from the Agora channel.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.connInfo:RtcConnInfo- Connection information.reason:int- The reason for the state change.
Occurs when a remote user joins the channel.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.userId:String- The ID of the remote user.
Occurs when a remote user leaves the channel.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.userId:String- The ID of the user who left.reason:int- The reason the user left.
The observer interface for local user events.
onAudioTrackPublishSuccess(AgoraLocalUser agoraLocalUser, AgoraLocalAudioTrack agoraLocalAudioTrack)
Occurs when a local audio track is published successfully.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user object.agoraLocalAudioTrack:AgoraLocalAudioTrack- The published audio track.
onVideoTrackPublishSuccess(AgoraLocalUser agoraLocalUser, AgoraLocalVideoTrack agoraLocalVideoTrack)
Occurs when a local video track is published successfully.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user object.agoraLocalVideoTrack:AgoraLocalVideoTrack- The published video track.
onUserAudioTrackSubscribed(AgoraLocalUser agoraLocalUser, String userId, AgoraRemoteAudioTrack agoraRemoteAudioTrack)
Occurs when a remote user's audio track is subscribed.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user object.userId:String- The ID of the remote user.agoraRemoteAudioTrack:AgoraRemoteAudioTrack- The remote audio track.
onUserVideoTrackSubscribed(AgoraLocalUser agoraLocalUser, String userId, VideoTrackInfo info, AgoraRemoteVideoTrack agoraRemoteVideoTrack)
Occurs when a remote user's video track is subscribed.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user object.userId:String- The ID of the remote user.info:VideoTrackInfo- Information about the video track.agoraRemoteVideoTrack:AgoraRemoteVideoTrack- The remote video track.
The observer interface for network events.
Occurs when uplink network information is updated.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.info:UplinkNetworkInfo- The uplink network information.
Occurs when downlink network information is updated.
- Parameters:
agoraRtcConn:AgoraRtcConn- The connection object.info:DownlinkNetworkInfo- The downlink network information.
The observer interface for raw video frames.
onFrame(AgoraVideoFrameObserver2 agoraVideoFrameObserver2, String channelId, String remoteUserId, VideoFrame frame)
Occurs when a video frame is received.
- Parameters:
agoraVideoFrameObserver2:AgoraVideoFrameObserver2- The observer object.channelId:String- The channel ID.remoteUserId:String- The ID of the remote user.frame:VideoFrame- The video frame.
The observer interface for raw audio frames.
Retrieves the recorded audio frame.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user.channelId:String- The channel ID.frame:AudioFrame- The audio frame.
- Returns:
int- 0/1 (no practical significance).
Retrieves the playback audio frame.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user.channelId:String- The channel ID.frame:AudioFrame- The audio frame.
- Returns:
int- 0/1 (no practical significance).
Retrieves the mixed audio frame.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user.channelId:String- The channel ID.frame:AudioFrame- The audio frame.
- Returns:
int- 0/1 (no practical significance).
onPlaybackAudioFrameBeforeMixing(AgoraLocalUser agoraLocalUser, String channelId, String userId, AudioFrame frame, VadProcessResult vadResult)
Retrieves the playback audio frame of a specific user before mixing.
- Parameters:
agoraLocalUser:AgoraLocalUser- The local user.channelId:String- The channel ID.userId:String- The user ID.frame:AudioFrame- The audio frame.vadResult:VadProcessResult- The VAD result.
- Returns:
int- 0/1 (no practical significance).
The observer interface for encoded audio frames.
onEncodedAudioFrameReceived(String remoteUserId, ByteBuffer buffer, EncodedAudioFrameReceiverInfo info)
Occurs when an encoded audio frame is received.
- Parameters:
remoteUserId:String- The ID of the remote user.buffer:ByteBuffer- The encoded audio frame buffer.info:EncodedAudioFrameReceiverInfo- Information about the encoded audio frame.
- Returns:
int- 0/1 (no practical significance).
The observer interface for encoded video frames.
onEncodedVideoFrame(AgoraVideoEncodedFrameObserver observer, int userId, ByteBuffer buffer, EncodedVideoFrameInfo info)
Occurs when an encoded video frame is received.
- Parameters:
observer:AgoraVideoEncodedFrameObserver- The observer object.userId:int- The user ID.buffer:ByteBuffer- The encoded video frame buffer.info:EncodedVideoFrameInfo- Information about the encoded video frame.
- Returns:
int- 0/1 (no practical significance).
The observer interface for receiving processed audio frames from AgoraExternalAudioProcessor.
onAudioFrame(AgoraExternalAudioProcessor audioProcessor, AudioFrame audioFrame, VadProcessResult vadProcessResult)
Called when a processed audio frame is available.
- Parameters:
audioProcessor:AgoraExternalAudioProcessor- The audio processor instance that generated this callback, useful when multiple processors share the same observer.audioFrame:AudioFrame- The processed audio frame.vadProcessResult:VadProcessResult- The VAD processing result, including the VAD state.
Configuration for the AgoraService.
enableAudioProcessor:int- Whether to enable the audio processing module.1(default) enables,0disables.enableAudioDevice:int- Whether to enable the audio device module for recording and playback.1enables,0(default) disables.enableVideo:int- Whether to enable video.1enables,0(default) disables.context:Object- The user context. For Windows, it's the window handle; for Android, it's the Activity context.appId:String- Your project's App ID.areaCode:int- The supported area code. Default isAREA_CODE_GLOB.channelProfile:int- The channel profile. Default isCHANNEL_PROFILE_LIVE_BROADCASTING.audioScenario:int- The audio scenario. Default isAUDIO_SCENARIO_AI_SERVER.useStringUid:int- Whether to enable string user ID.1enables,0(default) disables.logFilePath:String- The path for log files. Default isNULL.logFileSize:int- The maximum size of the log file in KB. Default is 2048.logFilters:int- The log level. Default isLOG_LEVEL_INFO.domainLimit:int- Whether to enable domain limit.1enables,0(default) disables.configDir:String- The path for configuration files. Default isNULL.dataDir:String- The path for data files. Default isNULL.enableApm:boolean- Whether to enable APM (Audio Processing Module).true(default) enables,falsedisables.apmConfig:AgoraApmConfig- The APM configuration.
Configuration for the RTC connection.
autoSubscribeAudio:int- Whether to automatically subscribe to all audio streams.1(default) for yes,0for no.autoSubscribeVideo:int- Whether to automatically subscribe to all video streams.1(default) for yes,0for no.enableAudioRecordingOrPlayout:int- Whether to enable audio recording or playout.1for yes,0for no.maxSendBitrate:int- The maximum sending bitrate.minPort:int- The minimum port for the connection.maxPort:int- The maximum port for the connection.audioSubsOptions:AudioSubscriptionOptions- Options for audio subscription.clientRoleType:int- The role of the user. Default isCLIENT_ROLE_AUDIENCE.channelProfile:int- The channel profile.audioRecvMediaPacket:int- Whether to receive audio media packets.audioRecvEncodedFrame:int- Whether to receive encoded audio frames.videoRecvMediaPacket:int- Whether to receive video media packets.
Configuration for publishing streams in an RTC connection.
audioProfile:int- The audio profile. Default isAUDIO_PROFILE_DEFAULT.audioScenario:int- The audio scenario. Default isAUDIO_SCENARIO_AI_SERVER.isPublishAudio:boolean- Whether to publish audio. Default istrue.isPublishVideo:boolean- Whether to publish video. Default isfalse.audioPublishType:Constants.AudioPublishType- The type of audio to publish. Default isPCM.videoPublishType:Constants.VideoPublishType- The type of video to publish. Default isNO_PUBLISH.senderOptions:SenderOptions- Options for the sender.
Information about the RTC connection.
id:int- Unique identifier for the connection.channelId:String- The channel ID.state:int- The current state of the connection.localUserId:String- The local user's ID.internalUid:int- The internal user ID.
Configuration for the video encoder.
codecType:int- The video codec type.dimensions:VideoDimensions- The dimensions of the video frame.frameRate:int- The video frame rate.bitrate:int- The video encoding target bitrate in Kbps.minBitrate:int- The minimum encoding bitrate in Kbps.orientationMode:int- The video orientation mode.degradationPreference:int- The video degradation preference under bandwidth constraints.mirrorMode:int- The video mirror mode.encodeAlpha:int- Whether to encode and send alpha data.
Options for video subscription.
type:int- The type of video subscription.encodedFrameOnly:int- Whether to subscribe to encoded frames only.
Configuration for a simulcast video stream.
dimensions:VideoDimensions- The dimensions of the video.bitrate:int- The bitrate of the video.framerate:int- The framerate of the video.
Information about an encoded video frame.
codecType:int- The video codec type.width:int- The width of the video in pixels.height:int- The height of the video in pixels.framesPerSecond:int- The number of video frames per second.frameType:int- The frame type of the encoded video frame.rotation:int- The rotation information of the encoded video frame.trackId:int- The track ID for multi-track video.captureTimeMs:long- The timestamp when the video was captured.decodeTimeMs:long- The timestamp for rendering the video.presentationMs:long- The presentation timestamp (PTS) of the video frame in ms.uid:int- The user ID.streamType:int- The stream type of the video frame.
Information about an encoded audio frame.
speech:int- Indicates whether the frame contains speech.codec:int- The codec type of the audio frame.sendEvenIfEmpty:int- Whether to send the frame even if it is empty.sampleRateHz:int- The sampling rate of the audio frame in Hz.samplesPerChannel:int- The number of samples per audio channel.numberOfChannels:int- The number of audio channels.captureTimeMs:long- The capture timestamp in ms.
Information for the receiver of an encoded audio frame.
sendTs:long- The send time of the packet.codec:int- The codec of the packet.
Options for the sender.
ccMode:int- The congestion control mode.codecType:int- The codec type.targetBitrate:int- The target bitrate.
Represents a video frame.
type:int- The type of video frame.width:int- The width of the video in pixels.height:int- The height of the video in pixels.yStride:int- The line span of the Y buffer in YUV data.uStride:int- The line span of the U buffer in YUV data.vStride:int- The line span of the V buffer in YUV data.yBuffer:ByteBuffer- The Y data buffer.uBuffer:ByteBuffer- The U data buffer.vBuffer:ByteBuffer- The V data buffer.rotation:int- The rotation of this frame (0, 90, 180, 270).renderTimeMs:long- The timestamp to render the video stream.avsyncType:int- The AV sync type.
Represents an external video frame.
type:int- The buffer type.format:int- The pixel format.buffer:ByteBuffer- The video buffer.stride:int- The line spacing of the video frame in pixels.height:int- The height of the video frame.timestamp:long- The timestamp of the video frame in ms.
Dimensions of a video.
width:int- The width of the video.height:int- The height of the video.
Statistics of an RTC connection.
duration:int- The duration of the call.txBytes:int- The total bytes transmitted.rxBytes:int- The total bytes received.txAudioBytes:int- The total audio bytes transmitted.txVideoBytes:int- The total video bytes transmitted.rxAudioBytes:int- The total audio bytes received.rxVideoBytes:int- The total video bytes received.txKBitRate:short- The transmission bitrate in Kbps.rxKBitRate:short- The reception bitrate in Kbps.userCount:int- The number of users in the channel.
Information about a user.
userId:String- The user ID.hasAudio:int- Whether the user has audio enabled.hasVideo:int- Whether the user has video enabled.
Result of a Voice Activity Detection (VAD) process.
outFrame:byte[]- The output frame after VAD processing.state:Constants.VadState- The state of the VAD process. Possible values:START_SPEAKING: Speech start detectedSPEAKING: Currently speakingSTOP_SPEAKING: Speech end detectedNONE: No speech detected
Configuration for Voice Activity Detection (VAD) version 2. This is the recommended VAD configuration class.
preStartRecognizeCount:int- Number of audio frames to cache before speech starts. These cached frames will be included when speech is detected. Default is 16 (approximately 160ms).startRecognizeCount:int- Number of consecutive audio frames required to confirm speech start. Larger values reduce false triggers but increase latency. Default is 30 (approximately 300ms).stopRecognizeCount:int- Number of consecutive audio frames required to confirm speech end. Larger values prevent premature cutoff but may include more silence. Default is 20 (approximately 200ms).activePercent:float- Percentage of active frames within the detection window required to enter speaking state. Range: 0.0-1.0. Default is 0.7.inactivePercent:float- Percentage of inactive frames within the detection window required to enter silence state. Range: 0.0-1.0. Default is 0.5.startVoiceProb:int- Voice probability threshold to start speech detection. Range: 0-100. Higher values require more confidence. Default is 70.stopVoiceProb:int- Voice probability threshold to stop speech detection. Range: 0-100. Default is 70.startRmsThreshold:int- RMS (volume) threshold in dB to start speech detection. Range: -100-0. Lower values are more sensitive. Default is -50.stopRmsThreshold:int- RMS (volume) threshold in dB to stop speech detection. Range: -100-0. Default is -50.
Statistics for a local audio track.
sourceId:int- The source ID of the audio.bufferedPcmDataListSize:int- The size of the buffered PCM data list.missedAudioFrames:int- The number of missed audio frames.sentAudioFrames:int- The number of sent audio frames.pushedAudioFrames:int- The number of pushed audio frames.droppedAudioFrames:int- The number of dropped audio frames.
Statistics for a local video track.
numberOfStreams:long- The number of video streams.bytesMajorStream:long- The bytes of the major stream.bytesMinorStream:long- The bytes of the minor stream.framesEncoded:int- The number of frames encoded.captureFrameRate:int- The capture frame rate in fps.encodeFrameRate:int- The encoder output frame rate in fps.targetMediaBitrateBps:int- The target bitrate in bps.
Statistics for a remote audio track.
uid:int- The user ID of the remote user.quality:int- The audio quality received.networkTransportDelay:int- The network delay in ms.jitterBufferDelay:int- The jitter buffer delay in ms.audioLossRate:int- The audio frame loss rate.receivedBitrate:int- The average bitrate of the received audio stream in Kbps.
Statistics for a remote video track.
uid:int- The user ID of the remote user.width:int- The width of the video stream in pixels.height:int- The height of the video stream in pixels.receivedBitrate:int- The received bitrate in Kbps.decoderOutputFrameRate:int- The decoder output frame rate in fps.frameLossRate:int- The video frame loss rate.
Configuration for stream encryption.
encryptionMode:int- The encryption mode.encryptionKey:String- The encryption key.encryptionKdfSalt:byte[]- The encryption KDF salt.
Information about the uplink network.
videoEncoderTargetBitrateBps:int- The target bitrate for the video encoder in bps.
Information about the downlink network.
lastmileBufferDelayTimeMs:int- The delay time in the last-mile buffer in ms.bandwidthEstimationBps:int- The estimated bandwidth in bps.peerDownlinkInfo:PeerDownlinkInfo- Information about the peer's downlink.
Information about a peer's downlink.
userId:String- The user ID.streamType:int- The stream type.currentDownscaleLevel:int- The current downscale level.expectedBitrateBps:int- The expected bitrate in bps.
APM (Audio Processing Module) configuration. Used for audio processing features including AI Noise Suppression, AI Echo Cancellation, Background Human Voice Suppression, and Automatic Gain Control.
aiNsConfig:AinsConfig- AI Noise Suppression configuration.aiAecConfig:AIAecConfig- AI Acoustic Echo Cancellation configuration.bghvsConfig:BghvsConfig- Background Human Voice Suppression configuration.agcConfig:AgcConfig- Automatic Gain Control configuration.enableDump:boolean- Whether to enable APM dump for debugging. Default isfalse.
AI Noise Suppression (AINS) configuration.
aiNsEnabled:boolean- Whether to enable AI Noise Suppression. Default istrue(enabled).nsEnabled:boolean- Whether to enable Noise Suppression. Default istrue(enabled).aiNsModelPref:int- AI NS model preference. Default is10.nsngAlgRoute:int- NSNG algorithm route. Default is12.nsngPredefAgg:int- NSNG predefined aggressiveness. Default is11.
AI Acoustic Echo Cancellation (AIAEC) configuration.
enabled:boolean- Whether to enable AIAEC. Default isfalse(disabled).splitSrateFor48k:int- Split sample rate for 48k audio. Default is16000.
Background Human Voice Suppression (BGHVS) configuration for APM.
enabled:boolean- Whether to enable BGHVS. Default istrue(enabled).vadThr:double- VAD (Voice Activity Detection) threshold. Range: 0.0 - 1.0. Default is0.8.
Automatic Gain Control (AGC) configuration for APM.
enabled:boolean- Whether to enable AGC. Default isfalse(disabled).
Represents an audio frame.
type:int- The audio frame type.sampleRate:int- The number of samples per second.channels:int- The number of audio channels.samplesPerChannel:int- The number of samples per channel in this frame.bytesPerSample:int- The number of bytes per sample.buffer:ByteBuffer- The data buffer of the audio frame.renderTimeMs:long- The timestamp to render the audio frame.
A utility class for dumping VAD (Voice Activity Detection) related data to files for debugging and analysis.
Constructs a VadDumpUtils object.
- Parameters:
path:String- The directory path where the dump files will be stored. A subdirectory with a timestamp name will be created inside this path.
Writes the audio frame and VAD result to the dump files.
- Parameters:
frame:AudioFrame- The original audio frame.vadResultBytes:byte[]- The audio data corresponding to the VAD result.vadResultState:Constants.VadState- The state of the VAD result.
Releases all resources and closes the dump files.