iOS echo cancellation in Unity

How to use the NatDevice plugin to implement iOS echo cancellation in Unity.

Prerequisites

Instructions

  • Add the following items to your Unity project's Packages/manifest.json

 { 
"scopedRegistries": [
    {
      "name": "NatML",
      "url": "https://registry.npmjs.com",
      "scopes": ["ai.natml"]
    }
  ],
  "dependencies": {
    "ai.natml.natdevice": "1.2.2"
  }
}
  • Copy your access key and add it to your Project Settings:

3b345c69-331e-40c5-bc96-bfa81400435a

  • Copy NatDeviceAudioSource.cs from the liveswitch demo project located at Assets/Scripts/Channel
  • Change the CreateAudioSource method in LocalMedia.cs to return NatDeviceAudioSource instead of AudioClipSource
  protected override AudioSource CreateAudioSource(AudioConfig config)
    {
        return new NatDeviceAudioSource(config);
    }

 

Please reach out to support@liveswitch.com if you would like us to provide you with a sample app to get you started.