Classes
The following declarations are available globally.
-
A wrapper class for input audio samples used in on-device machine learning using MediaPipe Task library.
Internally this class uses a ring buffer to hold input audio data. Clients could feed input audio data via
loadmethod and access the aggregated audio samples viabufferproperty.Note that this class can only handle input audio in Float. TODO: Investigate if
AVAudioFormatInt32should be supported. Only necessary if you can change the input format ofAVAudioEngineor load audio files usingAVAudioFormatInt32.Declaration
Swift
class AudioData: NSObject -
Wraps properties describing the format of the incoming audio samples, namely number of channels and the sample rate.
Declaration
Swift
class AudioDataFormat: NSObject -
A utility class to load audio files from file paths on iOS.
Declaration
Swift
class AudioLoader: NSObject -
Audio part representing the audio content block of a multi-modal block.
Declaration
Swift
class AudioPart: TaskPart -
A wrapper class to record the device's microphone continuously. Currently this class only supports recording up to 2 channels. If the number of channels is 2, then the mono microphone input is duplicated to provide dual channel data.
Internally the class manages an instance of
AVAudioEnginefor tapping the microphone samples.Recording sets the following parameters on the
AVAudioSession.sharedInstance():1.
category= .playAndRecord 2.mode= .default 3.categoryOptions= [.overrideMutedMicrophoneInterruption]If you need more control, use the native
AVAudioEnginedirectly for tapping the microphone.AudioRecorddoes not actively monitor audio interruptions, route changes, resetting of media services etc. They can be handled in the app using the notifications provided byAVFAudio. Refer to the official docs for the following: 1. Handling audio interruptions https://developer.apple.com/documentation/avfaudio/handling_audio_interruptions2. Responding to audio route changes https://developer.apple.com/documentation/avfaudio/responding_to_audio_route_change
3. Responding to resetting of media services https://developer.apple.com/documentation/avfaudio/avaudiosessionmediaserviceswereresetnotification
iOS may automatically stop the audio engine in some cases. A few examples of such events are a system interrupt, route change, etc. In such cases,
read(offset:length:)returnsTasksErrorCode.audioRecordNotTappingMicError. You can restart recording usingstartRecording().Note: Avoid setting the
AVAudioSession.sharedInstance()category, mode, options, channel configuration (enabling stereo) or other parameters while audio is being actively recorded using the audio record. Setting these parameters or changing the configuration ofAVAudioSession.sharedInstance()while a recording is in progress will result in undefined behaviour.Declaration
Swift
class AudioRecord: NSObject -
Holds the base options that is used for creation of any type of task. It has fields with important information acceleration configuration, TFLite model source etc.
Declaration
Swift
class BaseOptions: NSObject, NSCopying -
A default text chunking implementation using native C++ word-based chunking with overlap or character sliding window.
Declaration
Swift
class DefaultTextChunker: NSObject, TextChunker -
Represents the embedding for a given embedder head. Typically used in embedding tasks.
One and only one of the two 'floatEmbedding' and 'quantizedEmbedding' will contain data, based on whether or not the embedder was configured to perform scala quantization.
Declaration
Swift
class Embedding: NSObject -
Represents the embedding results of a model. Typically used as a result for embedding tasks.
Declaration
Swift
class EmbeddingResult: NSObject -
Image part representing the image content block of a multi-modal block.
Declaration
Swift
class ImagePart: TaskPart -
An image used in on-device machine learning using MediaPipe Task library.
Declaration
Swift
class MPImage: NSObject -
A wrapper class to store pointer to a float array and its size.
Declaration
Swift
class MPPFloatBuffer: NSObject, NSCopying -
Represents a single record retrieved from the SemanticRetriever.
Declaration
Swift
class RetrievalRecord: NSObject -
Represents a single result retrieved from the SemanticRetriever, including similarity/relevance score.
Declaration
Swift
class RetrievalResult: NSObject -
Performs on-device semantic search, vector storage, and query retrieval on text, image, and audio files.
Declaration
Swift
class SemanticRetriever: NSObject -
A configuration container class for initializing
MPPSemanticRetriever.Declaration
Swift
class SemanticRetrieverComponents: NSObject -
A vector store implementation backed by SQLite database using native SQLite vector engine.
Declaration
Swift
class SqliteVectorStore: NSObject, VectorStore -
MediaPipe Tasks options base class. Any MediaPipe task-specific options class should extend this class.
Declaration
Swift
class TaskOptions: NSObject, NSCopying -
Represents a part of a multi-modal content block.
Declaration
Swift
class TaskPart: NSObject -
MediaPipe Tasks result base class. Any MediaPipe task result class should extend this class.
Declaration
Swift
class TaskResult: NSObject, NSCopying -
Text part representing the text content block of a multi-modal block.
Declaration
Swift
class TextPart: TaskPart -
Performs multi-modal embedding extraction on text, image, audio, or custom content blocks.
This API wraps the native LiteRT-LM EmbeddingEngine directly, providing real on-device multimodal embeddings.
Declaration
Swift
class UniversalEmbedder: NSObject, EmbeddingProvider -
Options for setting up a
MPPUniversalEmbedder.Declaration
Swift
class UniversalEmbedderOptions: TaskOptions, NSCopying