MediaPipeTasksAudio Framework Reference

AudioEmbedder

class AudioEmbedder : NSObject

Performs audio embedding extraction on audio clips or continuous audio streams.

  • Creates an AudioEmbedder from a local model file path.

    Declaration

    Swift

    convenience init(modelPath: String) throws
  • Creates an AudioEmbedder from the given AudioEmbedderOptions.

    Declaration

    Swift

    init(options: AudioEmbedderOptions) throws
  • Extracts audio embeddings from the provided audio clip.

    Declaration

    Swift

    func embed(audioClip: AudioData) throws -> AudioEmbedderResult
  • Sends an audio block in a continuous stream for asynchronous embedding extraction.

    Declaration

    Swift

    func embedAsync(audioBlock: AudioData, timestampInMilliseconds: Int) throws
  • Computes cosine similarity between two Embedding objects.

    Declaration

    Swift

    class func cosineSimilarity(embedding1: Embedding, embedding2: Embedding) throws -> NSNumber
  • Closes and cleans up the MediaPipe audio embedder.

    Declaration

    Swift

    func close() throws