tencent cloud

Tencent Real-Time Communication

Release Notes and Announcements
Release Notes
Recent Product Announcement
TRTC Live (TUILiveKit) Product Launch Announcement
TRTC Conference Official Editions Launched
The commercial version of Conference is coming soon
Terms and Conditions Applicable to $9.9 Starter Package
Rules for the "First Subscription $100 Discount" Promotion
Announcement on the Start of Beta Testing for Multi-person Audio and Video Conference
TRTC Call Official Editions Launched
License Required for Video Playback in New Version of LiteAV SDK
TRTC to Offer Monthly Packages
Product Introduction
Overview
Concepts
Features
Strengths
Use Cases
Performance Statistics
Tencent RTC Quickplay: Experience Ultimate Real-Time Audio and Video Interaction!
Purchase Guide
Billing Overview
Free Minutes
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
FAQs
Refund Instructions
User Tutorial
Free Demo
Call
Overview
Activate the Service
Run Demo
Integration
Offline Call Push
Conversational Chat
On-Cloud Recording
AI Noise Reduction
UI Customization
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
Release Notes
FAQs
Conference
Overview(TUIRoomKit)
Activate the Service (TUIRoomKit)
Run Demo(TUIRoomKit)
Integration(TUIRoomKit)
Screen Sharing (TUIRoomKit)
Schedule a meeting (TUIRoomKit)
In-meeting Call (TUIRoomKit)
UI Customization(TUIRoomKit)
Virtual Background (TUIRoomKit)
Conference Control (TUIRoomKit)
Cloud Recording (TUIRoomKit)
AI Noise Reduction (TUIRoomKit)
In-Conference Chat (TUIRoomKit)
Robot Streaming (TUIRoomKit)
Enhanced Features (TUIRoomKit)
Client APIs (TUIRoomKit)
Server APIs (TUIRoomKit)
FAQs (TUIRoomKit)
Error Code (TUIRoomKit)
SDK Update Log (TUIRoomKit)
Live
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Run Demo
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDK Download
API Examples
Usage Guidelines
API Reference Manual
Advanced Features
AI Integration
Overview
Configure MCP Server
Install Skills
Integration Guide
FAQ
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Companion Transcription APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
Console Guide
Application Management
Package Management
Usage Statistics
Monitoring Dashboard
Development Assistance
Solution
Real-Time Chorus
FAQs
Migration Guide
Billing
Features
UserSig
Firewall Restrictions
How to Downsize Installation Package
Android and iOS
Web
Flutter
Electron
TRTCCalling for Web
Audio and Video Quality
Others
Legacy Documentation
RTC RoomEngine SDK(Old)
Integrating TUIRoom (Web)
Integrating TUIRoom (Android)
Integrating TUIRoom (iOS)
Integrating TUIRoom (Flutter)
Integrating TUIRoom (Electron)
TUIRoom APIs
On-Cloud Recording and Playback (Old)
RTC Analytics Monthly Packages (Previous Version)
Protocols and Policies
Compliance
Security White Paper
Notes on Information Security
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC Policy
Privacy Policy
Data Processing And Security Agreement
Glossary
DocumentationTencent Real-Time Communication

Adjust volume

Focus Mode
Font Size
Last updated: 2025-07-18 10:54:26
This article will explain how to:

Detect volume levels

Call enableAudioVolumeEvaluation to enable audio volume indication. After enabling this feature, the SDK will provide feedback on audio volume evaluation information for local or remote users in the TRTCCloudListener's onUserVoiceVolume callback, including volume level, voice detection, audio spectrum, etc.
Android
iOS
Mac
Windows
private TRTCCloud mCloud;
mCloud = TRTCCloud.sharedInstance(getApplicationContext());
mCloud.setListener(new TRTCCloudListener() {
// Get audio volume evaluation information through the onUserVoiceVolume callback @Override public void onUserVoiceVolume(ArrayList<TRTCCloudDef.TRTCVolumeInfo> userVolumes, int totalVolume) { super.onUserVoiceVolume(userVolumes, totalVolume);
// Update the UI here, for example, update the height of the sound column } });

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCCloudDef.TRTCAudioVolumeEvaluateParams audioVolumeEvaluateParams = new TRTCCloudDef.TRTCAudioVolumeEvaluateParams(); audioVolumeEvaluateParams.enablePitchCalculation = false; // Whether to enable local voice frequency calculation audioVolumeEvaluateParams.enableSpectrumCalculation = false; // Whether to enable sound spectrum calculation audioVolumeEvaluateParams.enableVadDetection = false; // Whether to enable local voice detection audioVolumeEvaluateParams.interval = 100; // Set the trigger interval for the onUserVoiceVolume callback to 100 ms

// Turn on the volume level prompt mNewCloud.enableAudioVolumeEvaluation(true, audioVolumeEvaluateParams);

// Turn off the volume level prompt mNewCloud.enableAudioVolumeEvaluation(false, audioVolumeEvaluateParams);
// AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate, TRTCCloudDelegate> // Add TRTCCloudDelegate interface declaration

@property (nonatomic, strong) TRTCCloud *trtcCloud; // Declare the trtcCloud instance

// AppDelegate.m
_trtcCloud = [TRTCCloud sharedInstance];
_trtcCloud.delegate = self;

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCAudioVolumeEvaluateParams *trtcAudioVolumeEvaluateParams = [[TRTCAudioVolumeEvaluateParams alloc] init];
trtcAudioVolumeEvaluateParams.enablePitchCalculation = NO; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = NO; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = NO; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
[self.trtcCloud enableAudioVolumeEvaluation:YES withParams:trtcAudioVolumeEvaluateParams];

// Implement TRTCCloudDelegate callback method
- (void)onUserVoiceVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume {
// Process user volume information
for (TRTCVolumeInfo *volumeInfo in userVolumes) {
NSLog(@"User ID: %@, Volume: %ld", volumeInfo.userId, (long)volumeInfo.volume);
// Update the UI here, such as updating the height of the volume bar
}
}

// Turn off the volume level prompt
[self.trtcCloud enableAudioVolumeEvaluation:NO withParams:trtcAudioVolumeEvaluateParams];
// AppDelegate.h
@interface AppDelegate : NSObject <NSApplicationDelegate, TRTCCloudDelegate> // Add TRTCCloudDelegate interface declaration

@property (nonatomic, strong) TRTCCloud *trtcCloud; // Declare the trtcCloud instance

// AppDelegate.m
_trtcCloud = [TRTCCloud sharedInstance];
_trtcCloud.delegate = self;

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCAudioVolumeEvaluateParams *trtcAudioVolumeEvaluateParams = [[TRTCAudioVolumeEvaluateParams alloc] init];
trtcAudioVolumeEvaluateParams.enablePitchCalculation = NO; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = NO; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = NO; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
[self.trtcCloud enableAudioVolumeEvaluation:YES withParams:trtcAudioVolumeEvaluateParams];

// Implement TRTCCloudDelegate callback method
- (void)onUserVoiceVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume {
// Process user volume information
for (TRTCVolumeInfo *volumeInfo in userVolumes) {
NSLog(@"User ID: %@, Volume: %ld", volumeInfo.userId, (long)volumeInfo.volume);
// Update the UI here, such as updating the height of the volume bar
}
}

// Turn off the volume level prompt
[self.trtcCloud enableAudioVolumeEvaluation:NO withParams:trtcAudioVolumeEvaluateParams];
// .h file
public:
ITRTCCloud* trtc_cloud_;
public:
virtual void onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume) override;

// .cpp file
trtc_cloud_ = getTRTCSharedInstance();
trtc_cloud_ -> addCallback(this);

TRTCAudioVolumeEvaluateParams trtcAudioVolumeEvaluteParams;
trtcAudioVolumeEvaluateParams.enablePitchCalculation = false; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = false; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = false; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
trtc_cloud_ -> enableAudioVolumeEvaluation(true, trtcAudioVolumeEvaluateParams);

// Implement TRTCCloudDelegate callback method, replace CLASSNAME with your class name
void CLASSNAME::onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume) {
// Update the UI here, such as updating the height of the volume bar
}

// Turn off the volume level prompt
trtc_cloud_ -> enableAudioVolumeEvaluation(false, trtcAudioVolumeEvaluateParams);

Detect if remote users are speaking after being muted

Android
iOS
Mac
Windows
private TRTCCloud mCloud;
mCloud = TRTCCloud.sharedInstance(getApplicationContext());
mCloud.startLocalAudio(TRTCCloudDef.TRTC_AUDIO_QUALITY_SPEECH); // Turn on the microphone

mCloud.muteLocalAudio(true); // Turn off the microphone

// Create a new TRTC instance to detect microphone volume
private TRTCCloud mNewCloud;
mNewCloud = TRTCCloud.sharedInstance(getApplicationContext());
mNewCloud.setListener(new TRTCCloudListener() {
// Obtain mCloud's audio volume evaluation information through the onUserVoiceVolume callback @Override public void onUserVoiceVolume(ArrayList<TRTCCloudDef.TRTCVolumeInfo> userVolumes, int totalVolume) { super.onUserVoiceVolume(userVolumes, totalVolume);
// Update the UI here, for example, update the height of the sound column } });

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCCloudDef.TRTCAudioVolumeEvaluateParams audioVolumeEvaluateParams = new TRTCCloudDef.TRTCAudioVolumeEvaluateParams(); audioVolumeEvaluateParams.enablePitchCalculation = false; // Whether to enable local voice frequency calculation audioVolumeEvaluateParams.enableSpectrumCalculation = false; // Whether to enable sound spectrum calculation audioVolumeEvaluateParams.enableVadDetection = false; // Whether to enable local voice detection audioVolumeEvaluateParams.interval = 100; // Set the trigger interval for the onUserVoiceVolume callback to 100 ms

// Turn on the volume level prompt mNewCloud.enableAudioVolumeEvaluation(true, audioVolumeEvaluateParams);
// AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate, TRTCCloudDelegate> // Add TRTCCloudDelegate interface declaration

@property (nonatomic, strong) TRTCCloud *trtcCloud; // Declare the trtcCloud instance
@property (nonatomic, strong) TRTCCloud *newTRTCCloud; // Declare the newTRTCCloud instance


// AppDelegate.m
_trtcCloud = [TRTCCloud sharedInstance];
_trtcCloud.delegate = self;
[self.trtcCloud startLocalAudio:TRTCAudioQualitySpeech]; // Turn the mic on

[self.trtcCloud muteLocalAudio:YES]; // Turn off the mic

// Initialize a new TRTC instance
_newTRTCCloud = [TRTCCloud sharedInstance];
_newTRTCCloud.delegate = self;

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCAudioVolumeEvaluateParams *trtcAudioVolumeEvaluateParams = [[TRTCAudioVolumeEvaluateParams alloc] init];
trtcAudioVolumeEvaluateParams.enablePitchCalculation = NO; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = NO; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = NO; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
[self.newTRTCCloud enableAudioVolumeEvaluation:YES withParams:trtcAudioVolumeEvaluateParams];

// Implement TRTCCloudDelegate callback method
- (void)onUserVoiceVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume {
// Process user volume information
for (TRTCVolumeInfo *volumeInfo in userVolumes) {
NSLog(@"User ID: %@, Volume: %ld", volumeInfo.userId, (long)volumeInfo.volume);
// Update the UI here, such as updating the height of the volume bar
}
}
// AppDelegate.h
@interface AppDelegate : NSObject <NSApplicationDelegate, TRTCCloudDelegate> // Add TRTCCloudDelegate interface declaration

@property (nonatomic, strong) TRTCCloud *trtcCloud; // Declare the trtcCloud instance
@property (nonatomic, strong) TRTCCloud *newTRTCCloud; // Declare the newTRTCCloud instance


// AppDelegate.m
_trtcCloud = [TRTCCloud sharedInstance];
_trtcCloud.delegate = self;
[self.trtcCloud startLocalAudio:TRTCAudioQualitySpeech]; // Turn the mic on

[self.trtcCloud muteLocalAudio:YES]; // Turn off the mic

// Initialize a new TRTC instance
_newTRTCCloud = [TRTCCloud sharedInstance];
_newTRTCCloud.delegate = self;

// Set the TRTCAudioVolumeEvaluateParams parameters
TRTCAudioVolumeEvaluateParams *trtcAudioVolumeEvaluateParams = [[TRTCAudioVolumeEvaluateParams alloc] init];
trtcAudioVolumeEvaluateParams.enablePitchCalculation = NO; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = NO; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = NO; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
[self.newTRTCCloud enableAudioVolumeEvaluation:YES withParams:trtcAudioVolumeEvaluateParams];

// Implement TRTCCloudDelegate callback method
- (void)onUserVoiceVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume {
// Process user volume information
for (TRTCVolumeInfo *volumeInfo in userVolumes) {
NSLog(@"User ID: %@, Volume: %ld", volumeInfo.userId, (long)volumeInfo.volume);
// Update the UI here, such as updating the height of the volume bar
}
}
// .h file
public:
ITRTCCloud* trtc_cloud_;
ITRTCCloud* new_trtc_cloud;
public:
virtual void onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume) override;

// .cpp file
trtc_cloud_ = getTRTCSharedInstance();
trtc_cloud_ -> addCallback(this);

trtc_cloud_ -> startLocalAudio(TRTCAudioQualitySpeech); // Turn the mic on

trtc_cloud_ -> muteLocalAudio(true); // Turn off the mic

// Create a new TRTC instance to detect microphone volume
new_trtc_cloud_ = getTRTCSharedInstance();
new_trtc_cloud_ -> addCallback(this);

TRTCAudioVolumeEvaluateParams trtcAudioVolumeEvaluteParams;
trtcAudioVolumeEvaluateParams.enablePitchCalculation = false; // Enable local voice frequency calculation
trtcAudioVolumeEvaluateParams.enableSpectrumCalculation = false; // Enable sound spectrum calculation
trtcAudioVolumeEvaluateParams.enableVadDetection = false; // Enable local voice detection
trtcAudioVolumeEvaluateParams.interval = 100; // Set the trigger interval of the onUserVoiceVolume callback to 100 ms

// Enable volume level prompt
new_trtc_cloud_ -> enableAudioVolumeEvaluation(true, trtcAudioVolumeEvaluateParams);

// Implement TRTCCloudDelegate callback method, replace CLASSNAME with your class name
void CLASSNAME::onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume) {
// Update the UI here, such as updating the height of the volume bar
}

Adjust volume level

Local Audio: The local microphone capture volume is set to 100 by default. You can call setAudioCaptureVolume to set the local audio capture volume.
Android
iOS
Mac
Windows
// Reduce the local microphone capture volume to 50
mCloud.setAudioCaptureVolume(50);

// Increase the local microphone capture volume to 100
mCloud.setAudioCaptureVolume(100);
// Reduce the local microphone capture volume to 50
[self.trtcCloud setAudioCaptureVolume:50];

// Increase the local microphone capture volume to 100
[self.trtcCloud setAudioCaptureVolume:100];
// Reduce the local microphone capture volume to 50
[self.trtcCloud setAudioCaptureVolume:50];

// Increase the local microphone capture volume to 100
[self.trtcCloud setAudioCaptureVolume:100];
// Reduce the local microphone capture volume to 50
trtc_cloud_ -> setAudioCaptureVolume(50);

// Increase the local microphone capture volume to 100
trtc_cloud_ -> setAudioCaptureVolume(100);
Remote Audio: The remote user volume playback size is set to 100 by default. You can call setRemoteAudioVolume to set the playback volume of a specific remote user.
Android
iOS
Mac
Windows
// Reduce Tom's playback volume to 50
mCloud.setRemoteAudioVolume("Tom", 50);

// Increase Tom's playback volume to 100
mCloud.setRemoteAudioVolume("Tom", 100);
// Reduce Tom's playback volume to 50
[self.trtcCloud setRemoteAudioVolume:@"Tom" volume:50];

// Increase Tom's playback volume to 100
[self.trtcCloud setRemoteAudioVolume:@"Tom" volume:100];
// Reduce Tom's playback volume to 50
[self.trtcCloud setRemoteAudioVolume:@"Tom" volume:50];

// Increase Tom's playback volume to 100
[self.trtcCloud setRemoteAudioVolume:@"Tom" volume:100];
// Reduce Tom's playback volume to 50
trtc_cloud_ -> setRemoteAudioVolume("Tom", 50);

// Increase Tom's playback volume to 100
trtc_cloud_ -> setRemoteAudioVolume("Tom", 100);
Note:
The recommended value range for volume is 0 - 100. If the volume still feels too low after setting it to 100, you can set the maximum volume to 150. However, setting the volume above 100 carries the risk of distortion. Please proceed with caution.

Contact Us

If you have any requirements or feedback, you can contact: info_rtc@tencent.com.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback