# Dubbing and Voice Changer (/en/realtime-media/marketplace/build/add-audio-effects/dubbing-voice-changer/ios)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Dubbing AI Voice Changer extension enables you to change the audio timbre.

This page shows you how to integrate the Dubbing AI Voice Changer extension in your app.

## Understand the tech [#understand-the-tech]

      
  
      
    Using the [setExtensionPropertyWithVendor](https://api-ref.agora.io/en/video-sdk/ios/4.x/documentation/agorartckit/agorartcenginekit/setextensionpropertywithvendor\(_\:extension\:extensioninfo\:key\:value:\)) method provided in Agora SDK v4.x and passing in the specified `key` and `value` parameters, you can quickly integrate real-time AI voice conversion ability into your app.

    The `key` parameter you specify in the `setExtensionPropertyWithVendor` method corresponds to the name of the API, and the `value` parameter wraps some or all of the parameters of the API in JSON format. By passing in the specified `key` and `value` parameters, you can call the corresponding API to realize the functions related to real-time AI sound conversion.

    
  
## Prerequisites [#prerequisites]

Ensure that your development environment meets the following requirements:

      
  
      
    * Xcode 9.0 or later.
    * A physical device (not an emulator) running iOS 8.0 or later.

    
  
* Dubbing AI Voice Changer is used with Agora Voice SDK v4.x.

  Refer to the [SDK quickstart](/en/realtime-media/voice/quickstart) to integrate Voice SDK v4.x and implement basic voice calling.

## Integrate the extension [#integrate-the-extension]

This section shows you how to integrate the Dubbing AI Voice Changer extension, and call the core API to implement the voice changing function.

      
  
      
    1. **Integrate the Dubbing AI Voice Changer extension**

       To integrate the extension in your project:

       1. Enter the [Extensions Marketplace](https://console.agora.io/v2/extensions-marketplace) page and download the plug-in package for **Extensions** plug-in.
       2. Unzip the folder, import all `.framework` files into the project, and modify `Embed` to `Embed & Sign`.
       3. Get the following resource files and save them in the same directory of the project folder (For example, Resource path):
          * License file and tone files: Contact Agora to obtain these files. The suffix of the tone file is named `.dat`, and the tone file is issued according to the license.
          * Model file: Download the required resources.
            ![Resource Files](https://assets-docs.agora.io/images/extensions-marketplace/resource-files.png)
       4. Import the `libc++` system library and third-party dynamic libraries into the project `MJExtension`.

    2. **Enable the plugin**

       After creating and initializing `RtcEngine`, call `enableExtensionWithVendor` to enable the plug-in, before you call other APIs such as `enableVideo`, and `joinChannelByToken`

       ```objc
       AgoraRtcEngineConfig *cfg = [[AgoraRtcEngineConfig alloc] init];
       cfg.appId = appId;
       cfg.eventDelegate = self;
       cfg.channelProfile = AgoraChannelProfileLiveBroadcasting;
       cfg.audioScenario = AgoraAudioScenarioGameStreaming;
       self.agoraKit = [AgoraRtcEngineKit sharedEngineWithConfig:cfg delegate:self];
       [self.agoraKit setClientRole:AgoraClientRoleBroadcaster];

       [self.agoraKit enableExtensionWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" enabled:YES];
       ```

    3. **Set the resource file path**

       When you download and integrate the plug-in, the license, sound, and model files are saved to the specified directory. In this step, you specify the path where these resource files are located.

       ```objc
       NSString *sourcePath = [[NSBundle mainBundle] resourcePath];
       [self.agoraKit setExtensionPropertyWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" key:@"setResourcesFilePath" value:sourcePath];
       ```

    4. **Get the tone list**

       After receiving the `onExtensionStarted` callback from Agora SDK, call `getExtensionPropertyWithVendor` passing in the `getSpeakersInfo` key to get the timbre list:

       ```objc
       NSString *voices = [self.agoraKit getExtensionPropertyWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" key:@"getSpeakersInfo"];
       // Convert JSON to array
       NSData *nsData = [voices dataUsingEncoding:NSUTF8StringEncoding];
       _speakerArray = [NSJSONSerialization JSONObjectWithData:nsData options:kNilOptions error:nil];
       ```

       The timbre list is returned as JSON data that you parse yourself.

    5. **Start changing**

       Call `setExtensionPropertyWithVendor` and pass in the corresponding `key` and `value`:

       ```objc
       [self.agoraKit setExtensionPropertyWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" key:@"startRealTimeTranscribe" value:@"startRealTimeTranscribe"];
       ```

    6. **Select timbre**

       Pass in the timbre ID from the obtained timbre list to set the corresponding timbre:

       ```objc
       [self.agoraKit setExtensionPropertyWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" key:@"changeSpeaker" value:@“”];
       ```

    7. **Stop changing**

       Call the API to stop the voice changer:

       ```objc
       [self.agoraKit setExtensionPropertyWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" key:@"stopRealTimeTranscribe" value:@"stopRealTimeTranscribe"];
       ```

    8. **Release resources**

       Close the plug-in and release the resources used by the plug-in:

       ```objc
       [self.agoraKit enableExtensionWithVendor:[EngineFilterManager vendorName] extension:@"RealTimeTranscribe" enabled:NO];
       ```

    
  
## Reference [#reference]

This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

      
  
      
    ### Sample project [#sample-project-1]

    The Dubbing AI Voice Changer extension provides a [GitHub sample project](https://github.com/Dubbing-AI-Voice-Changer/DubbingAgoraDemo/tree/main/iOS) for testing. To clone and run the project:

    1. Clone the repository

       ```sh
       git clone https://github.com/Dubbing-AI-Voice-Changer/DubbingAgoraDemo.git
       ```

    2. Refer to the `README.md` file in the repository to run the demo.

    ### API reference [#api-reference-1]

    * [enableExtensionWithVendor](https://api-ref.agora.io/en/video-sdk/ios/4.x/documentation/agorartckit/agorartcenginekit/enableextension\(withvendor\:extension\:enabled:\)) in the `AgoraRtcEngineKit` class
    * [setExtensionPropertyWithVendor](https://api-ref.agora.io/en/video-sdk/ios/4.x/documentation/agorartckit/agorartcenginekit/setextensionpropertywithvendor\(_\:extension\:extensioninfo\:key\:value:\)) in the `AgoraRtcEngineKit` class

    
  
