Skip to content

MimiSDK 13.0.0 Migration Guide

This document outlines the various changes required to migrate from MSDK 12.x.x to MSDK 13.0.0.

If you have further questions then please don't hesitate to get in touch with us via our Mimi Support Portal.

What is new?

MSDK 13.0.0 introduces feature-level activation control for top-level processing features. The first feature to adopt this is VoiceClarityFeature. Clients can now explicitly activate or deactivate the feature on the connected device, and observe its activation state — including whether an activation/deactivation call is currently in progress.

Required Migrations

AsyncState and LoadingState moved to libcommon

Both types have moved from io.mimi.sdk.core.common to io.mimi.sdk.common. Update your imports accordingly.

MSDK 12.x.x MSDK 13.0.0
io.mimi.sdk.core.common.AsyncState io.mimi.sdk.common.AsyncState
io.mimi.sdk.core.common.LoadingState io.mimi.sdk.common.LoadingState

ProcessingSession.voiceClarity is now a ProcessingFeatureController

A ProcessingFeatureController allows individual features to be temporarily and independently deactivated. Currently this is only supported for the voiceClarity feature.

Previously, ProcessingSession.voiceClarity was a nullable VoiceClarityFeature? representing the feature itself. In MSDK 13.0.0 it is a nullable ProcessingFeatureController<VoiceClarityFeature>? that wraps the feature and adds activation control.

The controller exposes:

  • feature: MimiObservable<AsyncState<VoiceClarityFeature?>> - observable handle to the underlying feature wrapped in an AsyncState.
    • The value is the VoiceClarityFeature instance when activated and null when deactivated.
    • The loadingState is:
      • LoadingState.InProgress while an activate / deactivate call is running,
      • LoadingState.Done when at rest, and;
      • LoadingState.Failure when the last call failed.
    • If the ProcessingFeatureController instance itself is null, then the wrapped feature is not supported on the connected device.
  • activate() / deactivate() - suspending functions that toggle the feature on the connected device and return a ProcessingFeatureActivationResult.

Accessing the underlying VoiceClarityFeature

If your code previously read modules directly from voiceClarity, you should now read them from voiceClarity?.feature?.state?.value (or observe voiceClarity?.feature to react to activation changes).

Before

val ambient = processingSession.voiceClarity?.ambient

After

val ambient = processingSession.voiceClarity?.feature?.state?.value?.ambient

Warning

You should also check your code to see if you previously compared processingSession.voiceClarity != null to determine if the voiceClarity feature was supported. If so, then you should change it to processingSession.voiceClarity?.feature.state.value != null.

Activating and deactivating features

activate() is used to activate the feature on the connected device.

The activation result is a sealed type: ProcessingFeatureActivationResult.Success or ProcessingFeatureActivationResult.Failure(cause).

Example: Activating

val result = processingSession.voiceClarity?.activate()
when (result) {
    is ProcessingFeatureActivationResult.Success -> {
        // Feature is now active; feature observable will emit the latest VoiceClarityFeature
        // with LoadingState.Done.
    }
    is ProcessingFeatureActivationResult.Failure -> {
        // result.cause describes why activation failed. The feature observable will emit
        // LoadingState.Failure(cause) while preserving the previous value.
    }
    null -> {
        // VoiceClarity not available on this device.
    }
}

deactivate() follows the similarly; on success, the feature observable transitions to value = null with LoadingState.Done.

Note

activate() always re-fetches the underlying feature on successful activation - even if the device was already active - this ensures that clients always see the latest device state after the call.

Observing feature activation state

The feature observable emits an AsyncState whose value carries the current feature instance and whose loadingState reflects the feature activation lifecycle. Observe both to keep your UI in sync.

Example: Observing

processingSession.voiceClarity?.feature?.observe { state: AsyncState<VoiceClarityFeature?> ->
    when (state.loadingState) {
        is LoadingState.InProgress -> {
            // Show a loading indicator on the VoiceClarity UI.
        }
        is LoadingState.Done -> {
            if (state.value != null) {
                // VoiceClarity is active - bind UI to state.value.ambient, state.value.denoiser, etc.
            } else {
                // VoiceClarity is inactive - hide / disable VoiceClarity UI.
            }
        }
        is LoadingState.Failure -> {
            // The last activate / deactivate call failed; state.value is unchanged.
            // (state.loadingState as LoadingState.Failure).cause describes why.
        }
    }
}