# Audio You can control user audio for an ongoing session using methods provided by the Video SDK. > Prior to using audio controls, you must **request permissions to use the microphone**. See the rest of this page for details and [Requesting authorization to capture and save media](https://developer.apple.com/documentation/avfoundation/capture_setup/requesting_authorization_to_capture_and_save_media) for more. ## Check if the user is connected to audio Before implementing audio controls, you must first check if the user is connected to audio by getting the user's `ZoomVideoSDKAudioType`. ```swift // Get the user's audioStatus. if let audioStatus = user.audioStatus() { // Get the user's audioType. let audioType = audioStatus.audioType } ``` ```objectivec // Get the user's audioStatus. ZoomVideoSDKAudioStatus *audioStatus = [user audioStatus]; // Get the user's audioType. ZoomVideoSDKAudioType audioType = [audioStatus audioType]; ``` ## Connect to audio If the user is not already connected, connect to the audio through the `ZoomVideoSDKAudioHelper`. ```swift if audioType == .none { // User's audio is not connected. // Get the ZoomVideoSDKAudioHelper to perform audio actions. if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() { // Connect User's audio. audioHelper.startAudio() } } else { // User is already connected to audio. } ``` ```objectivec if (audioType == ZoomVideoSDKAudioType_None) { // User's audio is not connected. // Get the ZoomVideoSDKAudioHelper to perform audio actions. ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper]; if (audioHelper) { // Connect User's audio. [audioHelper startAudio]; } } else { // User is already connected to audio. } ``` ## Mute audio Once connected, you can mute a user's audio by calling `muteAudio`: ```swift // Get the ZoomVideoSDKAudioHelper to perform audio actions. if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() { // Mute user. audioHelper.muteAudio(user) } ``` ```objectivec // Get the ZoomVideoSDKAudioHelper to perform audio actions. ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper]; if (audioHelper) { // Mute user. [audioHelper muteAudio:user]; } ``` ## Unmute audio Unmute a user's audio in a similar manner using `unmuteAudio`: ```swift // Get the ZoomVideoSDKAudioHelper to perform audio actions. if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() { // Unmute user. audioHelper.unmuteAudio(user) } ``` ```objectivec // Get the ZoomVideoSDKAudioHelper to perform audio actions. ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper]; if (audioHelper) { // Unmute user. [audioHelper unmuteAudio:user]; } ``` ## Disconnect from audio To disconnect completely from audio, use `stopAudio`: ```swift // Get the ZoomVideoSDKAudioHelper to perform audio actions. if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() { // Disconnect User's audio. audioHelper.stopAudio() } ``` ```objectivec // Get the ZoomVideoSDKAudioHelper to perform audio actions. ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper]; if (audioHelper) { // Disconnect User's audio. [audioHelper stopAudio]; } ``` ## Sound options By default, Zoom uses noise suppression and echo cancellation to improve the quality of the audio received by your microphone, but these audio filters can interfere with situations that require capturing the full range of audio. See [Configuring professional audio settings for Zoom Meetings](https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0059985) for details. Video SDK uses the same technology to improve audio quality, but also supports the ability to turn off these filters to capture the **original sound** of the microphone, for example, to support the use of a high-quality microphone with built-in audio filters or to capture the full audio range without noise suppression. _**Capturing the microphone's original sound disables the background noise suppression feature.**_ ### Original sound To enable original sound, set [`enableMicOriginalInput`](https://marketplacefront.zoom.us/sdk/custom/ios/interface_zoom_video_s_d_k_audio_setting_helper.html#a270820b658a85af0e4deea5719aa5e9b) to true (`YES`) in the `ZoomVideoSDKAudioSettingHelper` class. The default setting is false (`NO`). ```objectivec ZoomVideoSDKAudioSettingHelper *audioSettingHelper = [[ZoomVideoSDK shareInstance] getAudioSettingHelper]; [audioSettingHelper enableMicOriginalInput:YES]; ``` To disable, set `enableMicOriginalInput` to false (`NO`). ```objectivec [audioSettingHelper enableMicOriginalInput:NO]; ``` ## Callbacks The following are examples of some audio callbacks. ### Get notified when a user's audio status has changed ```swift func onUserAudioStatusChanged(_ helper: ZoomVideoSDKAudioHelper?, user userArray: [ZoomVideoSDKUser]?) { // UserArray contains the users that had an audio status change. // Use helper to perform actions on a user. if let userArray = userArray { for user in userArray { // Use .audioStatus().isMuted to check if a user's audio is muted. // If isMuted is true, the user is muted. If isMuted is false, the user is not on unmuted. if let userIsMuted = user.audioStatus()?.isMuted { if userIsMuted { // User's audio is not muted. } } // Use .audioStatus().audioType to obtain a certain user's audio type. if let audioType = user.audioStatus()?.audioType { print("User has audio type: \\(audioType)") } } } } ``` ```objectivec - (void)onUserAudioStatusChanged:(ZoomVideoSDKAudioHelper *)helper user:(NSArray *)userArray { // UserArray contains the users that had an audio status change. // Use helper to perform actions on a user. for (int i = 0; i < userArray.count; i++) { if (userArray[i]) { // Use .audioStatus().isMuted to check if a user's audio is muted. // If isMuted is true, the user is muted. If isMuted is false, the user is unmuted. if (userArray[i].audioStatus.isMuted) { // User's audio is muted. } // Use .audioStatus.audioType to obtain a certain user's audio type. NSLog(@"User has audio type: %lu", (unsigned long)userArray[i].audioStatus.audioType); } } } ``` ### Get notified when a user's active audio changes `onUserActiveAudioChanged` is different from `onUserAudioStatusChanged`. The SDK calls `onUserActiveAudioChanged` when a given user's audio changes, it calls `onUserAudioStatusChanged` when the user's audio status changes. For example, if the user is unmuted and is using their device's microphone, `onUserActiveAudioChanged` will be triggered whenever their microphone detects a noise. ```swift /** * onUserActiveAudioChanged is different from onUserAudioStatusChanged. * onUserActiveAudioChanged is called when a given user's audio changes, while * onUserAudioStatusChanged is called when the user's audio status changes. For * example, if the user is unmuted and is using their device's microphone, this * callback will be triggered whenever their microphone detects a noise. */ func onUserActiveAudioChanged(_ helper: ZoomVideoSDKUserHelper?, users userArray: [ZoomVideoSDKUser]?) { // UserArray contains the users that had an active audio change. // Use helper to perform audio actions. if let userArray = userArray { for user in userArray { // Use .audioStatus.talking to see if the user is currently talking. if let audioStatus = user.audioStatus(), audioStatus.talking, let userName = user.getName() { print("\\(userName) began talking.") } } } } ``` ```objectivec - (void)onUserActiveAudioChanged:(ZoomVideoSDKUserHelper *)helper users:(NSArray *)userArray { // UserArray contains the users that had an active audio change. // Use helper to perform audio actions. for (int i = 0; i < userArray.count; i++) { if (userArray[i]) { // Use .audioStatus.talking to see if the user is currently talking. if (userArray[i].audioStatus.talking) { NSLog(@"%@ began talking.", userArray[i].getUserName); } } } } ```