Tencent Cloud Audio Effect Management Module
Module: management class for background music, short audio effects, and voice effects Description: sets background music, short audio effects, and voice effects
◆ TXAudioMusicParam
◆ TXAudioEffectManager
class TXAudioEffectManager |
◆ enableVoiceEarMonitor()
- (void) enableVoiceEarMonitor: |
|
(BOOL) |
enable |
|
Enabling in-ear monitoring
After enabling in-ear monitoring, anchors can hear in earphones their own voice captured by the mic. This is designed for singing scenarios.
In-ear monitoring cannot be enabled for Bluetooth earphones. This is because Bluetooth earphones have high latency. Please ask anchors to use wired earphones via a UI reminder. Given that not all phones deliver excellent in-ear monitoring effects, we have blocked this feature on some phones.
- Attention
- In-ear monitoring can be enabled only when earphones are used. Please remind anchors to use wired earphones.
- Parameters
-
enable | true: enable; false : disable |
◆ setVoiceEarMonitorVolume()
- (void) setVoiceEarMonitorVolume: |
|
(NSInteger) |
volume |
|
Setting in-ear monitoring volume
This API is used to set the volume of in-ear monitoring.
- Parameters
-
volume | Volume. Value range: 0-100; default: 100 |
- Attention
- If 100 is still not loud enough for you, you can contact technical support to set the volume to up to 150, but there may be side effects.
◆ setVoiceReverbType()
Setting voice reverb effects
This API is used to set reverb effects for human voice. For the effects supported, please see TXVoiceReverbType.
- Attention
- Effects become invalid after room exit. If you want to use the same effect after you enter the room again, you need to set the effect again using this API.
◆ setVoiceChangerType()
Setting voice changing effects
This API is used to set voice changing effects. For the effects supported, please see TXVoiceChangeType.
- Attention
- Effects become invalid after room exit. If you want to use the same effect after you enter the room again, you need to set the effect again using this API.
◆ setVoiceVolume()
- (void) setVoiceVolume: |
|
(NSInteger) |
volume |
|
Setting speech volume
This API is used to set the volume of speech. It is often used together with the music volume setting API setAllMusicVolume to balance between the volume of music and speech.
- Parameters
-
volume | Volume. Value range: 0-100; default: 100 |
- Attention
- If 100 is still not loud enough for you, you can contact technical support to set the volume to up to 150, but there may be side effects.
◆ startPlayMusic:onStart:onProgress:onComplete()
Starting background music
You must assign an ID to each music track so that you can start, stop, or set the volume of music tracks by ID.
- Attention
- If you play the same music track multiple times, please use the same ID instead of a separate ID for each playback.
- If you want to play different music tracks at the same time, use different IDs for them.
- If you use the same ID to play a music track different from the current one, the SDK will stop the current one before playing the new one.
- Parameters
-
musicParam | Music parameter |
startBlock | Callback of starting music |
progressBlock | Callback of playback progress |
completeBlock | Callback of ending music |
◆ stopPlayMusic()
- (void) stopPlayMusic: |
|
(int32_t) |
id |
|
Stopping background music
- Parameters
-
◆ pausePlayMusic()
- (void) pausePlayMusic: |
|
(int32_t) |
id |
|
Pausing background music
- Parameters
-
◆ resumePlayMusic()
- (void) resumePlayMusic: |
|
(int32_t) |
id |
|
Resuming background music
- Parameters
-
◆ setAllMusicVolume()
- (void) setAllMusicVolume: |
|
(NSInteger) |
volume |
|
Setting the local and remote playback volume of background music
This API is used to set the local and remote playback volume of background music.
- Local volume: the volume of music heard by anchors
- Remote volume: the volume of music heard by audience
- Parameters
-
volume | Volume. Value range: 0-100; default: 100 |
- Attention
- If 100 is still not loud enough for you, you can contact technical support to set the volume to up to 150, but there may be side effects.
◆ setMusicPublishVolume:volume()
- (void) setMusicPublishVolume: |
|
(int32_t) |
id |
volume: |
|
(NSInteger) |
volume |
|
|
| |
Setting the remote playback volume of a specific music track
This API is used to control the remote playback volume (the volume heard by audience) of a specific music track.
- Parameters
-
id | Music ID |
volume | Volume. Value range: 0-100; default: 100 |
- Attention
- If 100 is still not loud enough for you, you can contact technical support to set the volume to up to 150, but there may be side effects.
◆ setMusicPlayoutVolume:volume()
- (void) setMusicPlayoutVolume: |
|
(int32_t) |
id |
volume: |
|
(NSInteger) |
volume |
|
|
| |
Setting the local playback volume of a specific music track
This API is used to control the local playback volume (the volume heard by anchors) of a specific music track.
- Parameters
-
id | Music ID |
volume | Volume. Value range: 0-100. default: 100 |
- Attention
- If 100 is still not loud enough for you, you can contact technical support to set the volume to up to 150, but there may be side effects.
◆ setMusicPitch:pitch()
- (void) setMusicPitch: |
|
(int32_t) |
id |
pitch: |
|
(double) |
pitch |
|
|
| |
Adjusting the pitch of background music
- Parameters
-
id | Music ID |
pitch | Pitch. Value range: floating point numbers in the range of [-1, 1]; default: 0.0f |
◆ setMusicSpeedRate:speedRate()
- (void) setMusicSpeedRate: |
|
(int32_t) |
id |
speedRate: |
|
(double) |
speedRate |
|
|
| |
Changing the speed of background music
- Parameters
-
id | Music ID |
speedRate | Music speed. Value range: floating point numbers in the range of [0.5, 2]; default: 1.0f |
◆ getMusicCurrentPosInMS()
- (NSInteger) getMusicCurrentPosInMS: |
|
(int32_t) |
id |
|
Getting the playback progress (ms) of background music
- Parameters
-
- Returns
- The milliseconds that have passed since playback started. -1 indicates failure to get the the playback progress.
◆ getMusicDurationInMS()
- (NSInteger) getMusicDurationInMS: |
|
(NSString *) |
path |
|
Getting the total length (ms) of background music
- Parameters
-
path | Path of the music file. If it is not specified, the length of the music file being played is returned. |
- Returns
- The length of the specified music file is returned. -1 indicates failure to get the length.
◆ seekMusicToPosInMS:pts()
- (void) seekMusicToPosInMS: |
|
(int32_t) |
id |
pts: |
|
(NSInteger) |
pts |
|
|
| |
Setting the playback progress (ms) of background music
- Attention
- Do not call this API frequently as the music file may be read and written to each time the API is called, which can be time-consuming. Wait till users finish dragging the progress bar before you call this API. The progress bar controller on the UI tends to update the progress at a high frequency as users drag the progress bar. This will result in poor user experience unless you limit the frequency.
- Parameters
-
id | Music ID |
pts | Unit: millisecond |
◆ TXAudioMusicStartBlock
typedef void(^ TXAudioMusicStartBlock) (NSInteger errCode) |
Background music started.
◆ TXAudioMusicProgressBlock
typedef void(^ TXAudioMusicProgressBlock) (NSInteger progressMs, NSInteger durationMs) |
Playback progress of background music.
◆ TXAudioMusicCompleteBlock
typedef void(^ TXAudioMusicCompleteBlock) (NSInteger errCode) |
◆ TXVoiceReverbType
Reverb effects
Reverb effects can be applied to human voice. Based on acoustic algorithms, they can mimic voice in different environments. The following effects are supported currently: 0: original; 1: karaoke; 2: room; 3: hall; 4: low and deep; 5: resonant; 6: metal; 7: husky
Enumerator |
---|
TXVoiceReverbType_0 | Disable.
|
TXVoiceReverbType_1 | Karaoke.
|
TXVoiceReverbType_2 | Room.
|
TXVoiceReverbType_3 | Hall.
|
TXVoiceReverbType_4 | Low and deep.
|
TXVoiceReverbType_5 | Resonant.
|
TXVoiceReverbType_6 | Metal.
|
TXVoiceReverbType_7 | Husky.
|
◆ TXVoiceChangeType
Voice changing effects
Voice changing effects can be applied to human voice. Based on acoustic algorithms, they change the tone of voice. The following effects are supported currently: 0: original; 1: child; 2: little girl; 3: middle-aged man; 4: metal; 5: nasal; 6: foreign accent; 7: trapped beast; 8: otaku; 9: electric; 10: robot; 11: ethereal
Enumerator |
---|
TXVoiceChangeType_0 | Disable.
|
TXVoiceChangeType_1 | Child.
|
TXVoiceChangeType_2 | Little girl.
|
TXVoiceChangeType_3 | Middle-aged man.
|
TXVoiceChangeType_4 | Metal.
|
TXVoiceChangeType_5 | Nasal.
|
TXVoiceChangeType_6 | Foreign accent.
|
TXVoiceChangeType_7 | Trapped beast.
|
TXVoiceChangeType_8 | Otaku.
|
TXVoiceChangeType_9 | Electric.
|
TXVoiceChangeType_10 | Robot.
|
TXVoiceChangeType_11 | Ethereal.
|
◆ NS_UNAVAILABLE()
- (instancetype) NS_UNAVAILABLE |
|
|
|
You cannot create a TXAudioEffectManager
object. You need to obtain the object using the getAudioEffectManager
API of TRTCCloud
or TXLivePush
.
◆ ID
◆ loopCount
◆ publish
◆ isShortFile