Class VoiceTemplate

java.lang.Object
net.idrnd.voicesdk.common.VoiceSdkNativePeer
net.idrnd.voicesdk.core.common.VoiceTemplate
All Implemented Interfaces:
AutoCloseable

public class VoiceTemplate extends VoiceSdkNativePeer
Represents the result of audio data processing that can be used for similarity checks.

This class serves as gateway to native Voice SDK implementation and allocates resources on native heap. To release the allocated memory, AutoCloseable.close() method should be invoked when the instance is no longer needed.

  • Method Details

    • saveToFile

      public void saveToFile(String filepath)
      Saves VoiceTemplate object into file.
      Parameters:
      filepath - output file path
      Throws:
      VoiceSdkEngineException - wraps native exceptions
    • loadFromFile

      public static VoiceTemplate loadFromFile(String filepath)
      Creates VoiceTemplate from file.
      Parameters:
      filepath - input file path
      Returns:
      Newly created VoiceTemplate object
      Throws:
      VoiceSdkEngineException - wraps native exceptions
    • serialize

      public byte[] serialize()
      Converts VoiceTemplate object into raw bytes array.
      Returns:
      Byte array
    • isValid

      public boolean isValid()
      Checks whether generated voice template is valid or not.
      Returns:
      Boolean value which is true if VoiceTemplate is valid and false otherwise
    • getChannelType

      public ChannelType getChannelType()
      Returns the channel type of audio record which was used to create voice template.
      Returns:
      Voice template channel type
    • getInitDataId

      public String getInitDataId()
      Returns the set of engine methods used to create this template.
      Returns:
      Init data ID
      Throws:
      VoiceSdkEngineException - wraps native exceptions
    • deserialize

      public static VoiceTemplate deserialize(byte[] data)
      Restores VoiceTemplate object from raw bytes array.
      Parameters:
      data - input bytes
      Returns:
      Newly created VoiceTemplate object
      Throws:
      VoiceSdkEngineException - wraps native exceptions