Optimize Audio Track - iOS
While optimizing for the best listening experience, it is necessary to fine-tune the audio track that is being used during the calls.
For the best fine-tuning experience, we have introduced the ability to pass a custom audio track for the participant's media before and during the meeting.
Custom Audio Track
This feature can be used to create a custom Audio track for the Audio of the participants with different encoder configuration and send it to other participants.
How to Create Custom Audio Track ?
-
You can create a Audio Track using
createAudioTrack()
method ofVideoSDK
class. -
This method can be used to create audio track using different noise configurations.
Example
- Swift
guard let audioMediaTrack = try? VideoSDK.createAudioTrack(
noiseConfig: noiseConfig(
// It is used to improve the quality of audio by removing background noise
// that can interfere with the clarity of speech.
noiseSupression: true,
// It is used to remove unwanted echoes from voice.
echoCancellation: true,
// It is used to maintain a consistent level of loudness or amplitude in a voice.
autoGainControl: true,
// It removes low frequency sounds hence making the audio clearer.
highPassFilter: true
)
) else {return}
How to Setup Custom Audio Track ?
The custom track can be set up both before and after the initialization of the meeting.
- Setting up a Custom Track during the initialization of a meeting
- Setting up a Custom Track with methods
1. Setting up a Custom Track during the initialization of a meeting
If you are passing micEnabled: true
in the initMeeting
of VideoSDK
and want to use custom tracks from start of the meeting, you can pass custom track in the initMeeting
as shown below.
Custom Track will not apply on micEnabled: false
configuration.
Example
- Swift
guard let customAudioStream = try? VideoSDK.createAudioTrack(
noiseConfig: noiseConfig(
noiseSupression: true,
echoCancellation: true,
autoGainControl: true,
highPassFilter: true
)
) else {return}
let meeting = VideoSDK.initMeeting(
meetingId: meetingId,
participantName: name,
micEnabled: true, // when passed true, it creates an audio track with defined configs
webcamEnabled: cameraEnabled // optional, default: true
// Pass the custom audio track here which will be used to when mic is auto started
customAudioStream: customAudioStream
)
2. Setting up a Custom Track with methods
In order to switch tracks during the meeting, you have to pass the customAudioStream
in the unmuteMic()
method of Meeting
.
Make sure to call muteMic()
before you create a new track as it may lead to unexpected behavior.
Example
- Swift
@IBAction func unmuteButtonTapped(_ sender: Any) {
if !on {
guard
let audioMediaTrack = try? VideoSDK.createAudioTrack(
noiseConfig: noiseConfig(
noiseSupression: true,
echoCancellation: true,
autoGainControl: true,
highPassFilter: true
)
)
else { return }
self.meeting?.unmuteMic(customAudioStream: audioMediaTrack)
} else {
self.meeting?.muteMic()
}
}
API Reference
The API references for all the methods and events utilised in this guide are provided below.
Got a Question? Ask us on discord