Package com.intellijava.core.controller
Class RemoteSpeechModel
java.lang.Object
com.intellijava.core.controller.RemoteSpeechModel
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 Summary
ConstructorDescriptionRemoteSpeechModel
(String keyValue, SpeechModels keyType) Constructs a new RemoteSpeechModel object with the specified key value and key type.RemoteSpeechModel
(String keyValue, String keyTypeString) Constructs a new RemoteSpeechModel object with the specified key value and key type string. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Generates speech using advanced audio models.byte[]
Generates speech using advanced audio models.byte[]
Generates speech using advanced audio models.byte[]
Generates speech using advanced audio models.byte[]
generateText
(Text2SpeechInput input, String langCode) Generates speech using advanced audio models.byte[]
Generates speech using advanced audio models.Get a list of supported key type models.
-
Constructor Details
-
RemoteSpeechModel
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
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
Get a list of supported key type models.- Returns:
- list of the supported SpeechModels enum values.
-
generateEnglishText
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
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
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
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
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
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.
-