MediaPipeTasksAudio Framework Reference

AudioClassifierStreamDelegate

protocol AudioClassifierStreamDelegate : NSObjectProtocol

This protocol defines an interface for the delegates of AudioClassifier object to receive results of asynchronous classification of audio stream (i.e, when runningMode = .audioStream).

The delegate of AudioClassifier must adopt AudioClassifierStreamDelegate protocol. The methods in this protocol are optional.

  • This method notifies a delegate that the results of asynchronous classification of an audio stream submitted to the AudioClassifier is available.

    This method is called on a private serial queue created by the AudioClassifier for performing the asynchronous delegates calls.

    Declaration

    Swift

    optional func audioClassifier(_ AudioClassifier: AudioClassifier, didFinishClassification result: AudioClassifierResult?, timestampInMilliseconds: Int, error: (any Error)?)

    Parameters

    AudioClassifier

    The audio classifier which performed the classification. This is useful to test equality when there are multiple instances of AudioClassifier.

    result

    An AudioClassifierResult object that contains a list of audio classifications.

    timestampInMilliseconds

    The timestamp (in milliseconds) which indicates when the audio clip was sent to the audio classifier.

    error

    An optional error parameter populated when there is an error in performing audio classification on the input audio stream data.