Classes
The following declarations are available globally.
-
Class that performs classification on audio data.
This API expects a TFLite model with mandatory TFLite Model Metadata that contains the mandatory AudioProperties of the solo input audio tensor and the optional (but recommended) category labels as AssociatedFiles with type TENSOR_AXIS_LABELS per output classification tensor.
Input tensor (kTfLiteFloat32) - input audio buffer of size
[batch * samples]. - batch inference is not supported (batchis required to be 1). - for multi-channel models, the channels must be interleaved.At least one output tensor with: (kTfLiteFloat32) -
[1 x N]array withNrepresents the number of categories. - optional (but recommended) category labels as AssociatedFiles with type TENSOR_AXIS_LABELS, containing one label per line. The first such AssociatedFile (if any) is used to fill thecategory_namefield of the results. Thedisplay_namefield is filled from the AssociatedFile (if any) whose locale matches thedisplay_names_localefield of theAudioClassifierOptionsused at creation time ("en" by default, i.e. English). If none of these are available, only theindexfield of the results will be filled.Declaration
Swift
class AudioClassifier: NSObject -
Options for setting up a
AudioClassifier.Declaration
Swift
class AudioClassifierOptions: TaskOptions, NSCopying -
Represents the classification results generated by
AudioClassifier. *Declaration
Swift
class AudioClassifierResult: TaskResult, NSCopying -
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 -
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 -
Performs automatic speech recognition (ASR) on streaming mono PCM float audio samples.
Declaration
Swift
class AudioTranscriber: NSObject -
Options for configuring a MediaPipe
MPPAudioTranscribertask.Declaration
Swift
class AudioTranscriberOptions: TaskOptions, NSCopying -
Represents the transcription results generated by
MPPAudioTranscriber.Declaration
Swift
class AudioTranscriberResult: TaskResult, NSCopying -
A single transcribed segment emitted by
MPPAudioTranscriber.Declaration
Swift
class AudioTranscriberSegment: 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 -
Represents the classification results of a model. Typically used as a result for classification tasks.
Declaration
Swift
class ClassificationResult: NSObject -
Represents the list of classification for a given classifier head. Typically used as a result for classification tasks.
Declaration
Swift
class Classifications: NSObject -
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 -
A wrapper class to store pointer to a float array and its size.
Declaration
Swift
class MPPFloatBuffer: NSObject, NSCopying -
Category is a util class that contains a label, its display name, a float value as score, and the index of the label in the corresponding label file. Typically it's used as the result of classification tasks.
Declaration
Swift
class ResultCategory: NSObject -
Bidirectional / pull-based streaming synthesis handle supporting Level 2 incremental LLM text pushing (
pushText+finishInput) alongsidereadNext()andcancel().Declaration
Swift
final class TTSStream: Sendable -
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 -
MediaPipe TextToSpeech task interface for Swift (iOS / macOS).
Declaration
Swift
final class TextToSpeech: Sendable