Class RemoteSpeechModel

java.lang.Object
com.intellijava.core.controller.RemoteSpeechModel

public class RemoteSpeechModel extends Object
RemoteSpeechModel class provides a remote speech model implementation. It generates speech from text using the Wrapper classes. This version support google speech models only. To use Google speech services: 1- Go to console.cloud.google.com. 2- Enable "Cloud Text-to-Speech API". 3- Generate API key from "Credentials" page.
Author:
github.com/Barqawiz
  • Constructor Details

    • RemoteSpeechModel

      public RemoteSpeechModel(String keyValue, String keyTypeString)
      Constructs a new RemoteSpeechModel object with the specified key value and key type string. If keyTypeString is empty, it is set to "google" by default.
      Parameters:
      keyValue - the API key value to use.
      keyTypeString - the string representation of the key type.
    • RemoteSpeechModel

      public RemoteSpeechModel(String keyValue, SpeechModels keyType)
      Constructs a new RemoteSpeechModel object with the specified key value and key type.
      Parameters:
      keyValue - The API key value to use.
      keyType - The SpeechModels enum value representing the key type.
  • Method Details

    • getSupportedModels

      public List<String> getSupportedModels()
      Get a list of supported key type models.
      Returns:
      list of the supported SpeechModels enum values.
    • generateEnglishText

      public byte[] generateEnglishText(Text2SpeechInput input) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.
    • generateMandarinText

      public byte[] generateMandarinText(Text2SpeechInput input) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.
    • generateArabicText

      public byte[] generateArabicText(Text2SpeechInput input) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.
    • generateTurkishText

      public byte[] generateTurkishText(Text2SpeechInput input) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.
    • generateText

      public byte[] generateText(Text2SpeechInput input, String langCode) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      langCode - the language code, make sure to use the right code for the model engine.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.
    • generateGermanText

      public byte[] generateGermanText(Text2SpeechInput input) throws IOException
      Generates speech using advanced audio models. You can save the result byte to audio file using FileOutputStream("path/audio.mp3").
      Parameters:
      input - SpeechInput object containing the text and gender to use.
      Returns:
      byte array of the decoded audio content.
      Throws:
      IOException - in case of communication error.