VoiceTemplateFactory

Superclass:
NSObject
Declared In:

Introduction

Class for creating and merging voice templates.



Methods

-createVoiceTemplate:channelType:error:

Creates template with contents of the given WAV file.

-createVoiceTemplate:error:

Creates template with contents of the given WAV file.

-createVoiceTemplate:sampleRate:channelType:error:

Creates template from the given PCM16 audio samples.

-createVoiceTemplate:sampleRate:error:

Creates template from the given PCM16 audio samples.

-getInitDataId:

Returns ID of the init data, which was used to create the factory.

-getMinimumAudioSampleRate:

Returns minimum supported input audio sampling frequency in Hz.

-initWithPath:error:

Creates VoiceTemplateFactory instance.

-mergeVoiceTemplates:error:

Merges multiple voice templates of a single speaker to a union voice template.


createVoiceTemplate:channelType:error:


Creates template with contents of the given WAV file.

- (VoiceTemplate* _Nullable)createVoiceTemplate:(NSString* _Nonnull)wavPath 
        channelType:(ChannelType)channelType error:(NSError* _Nullable* _Nullable)error; 
Parameters
wavPath

path to WAV file

channelType

audio signal channel type

error

pointer to NSError for error reporting

WAV sampling frequency should be equal to or greater than the value returned by:

VoiceTemplateFactory::getMinimumAudioSampleRate.

Return Value

Created voice template.


createVoiceTemplate:error:


Creates template with contents of the given WAV file.

- (VoiceTemplate* _Nullable)createVoiceTemplate:(NSString* _Nonnull)wavPath 
        error:(NSError* _Nullable* _Nullable)error; 
Parameters
wavPath

path to WAV file

error

pointer to NSError for error reporting

WAV sampling frequency should be equal to or greater than the value returned by:

VoiceTemplateFactory::getMinimumAudioSampleRate.

Return Value

Created voice template.


createVoiceTemplate:sampleRate:channelType:error:


Creates template from the given PCM16 audio samples.

- (VoiceTemplate* _Nullable)createVoiceTemplate:(NSData* _Nonnull)PCM16Samples 
        sampleRate:(size_t)sampleRate channelType:(ChannelType)channelType 
        error:(NSError* _Nullable* _Nullable)error; 
Parameters
PCM16Samples

PCM16 audio data

sampleRate

audio sample rate

channelType

audio signal channel type

error

pointer to NSError for error reporting

Audio sampling frequency should be equal to or greater than the value returned by:

VoiceTemplateFactory::getMinimumAudioSampleRate.

Return Value

Created voice template.


createVoiceTemplate:sampleRate:error:


Creates template from the given PCM16 audio samples.

- (VoiceTemplate* _Nullable)createVoiceTemplate:(NSData* _Nonnull)PCM16Samples 
        sampleRate:(size_t)sampleRate error:(NSError* _Nullable* _Nullable)error; 
Parameters
PCM16Samples

PCM16 audio data

sampleRate

audio sample rate

error

pointer to NSError for error reporting

Audio sampling frequency should be equal to or greater than the value returned by:

VoiceTemplateFactory::getMinimumAudioSampleRate.

Return Value

Created voice template.


getInitDataId:


Returns ID of the init data, which was used to create the factory.

- (NSString* _Nullable)getInitDataId:(NSError* _Nullable* _Nullable)error; 
Parameters
error

pointer to NSError for error reporting

Return Value

A string containing init data ID.


getMinimumAudioSampleRate:


Returns minimum supported input audio sampling frequency in Hz.

- (NSNumber* _Nullable)getMinimumAudioSampleRate:(NSError* _Nullable* _Nullable)error; 
Parameters
error

pointer to NSError for error reporting

Return Value

A minimum sampling rate in Hz.


initWithPath:error:


Creates VoiceTemplateFactory instance.

- (instancetype _Nullable)initWithPath:(NSString* _Nonnull)path 
        error:(NSError* _Nullable* _Nullable)error; 
Parameters
path

path to the init data folder

error

pointer to NSError for error reporting


mergeVoiceTemplates:error:


Merges multiple voice templates of a single speaker to a union voice template.

- (VoiceTemplate* _Nullable)mergeVoiceTemplates:(NSArray* _Nonnull)templates 
        error:(NSError* _Nullable* _Nullable)error; 
Parameters
templates

array of a single speaker voice templates

error

pointer to NSError for error reporting

Return Value

A union voice template.

All the templates should have the same init data ID as the factory instance.: