Package velox.api.layer1.layers.utils
Class SoundSynthHelper
java.lang.Object
velox.api.layer1.layers.utils.SoundSynthHelper
Wrapper around TTS library. Use this if you need to generate sound from text.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidPerform initialization.static voidSynthesize and say immediately.static byte[]synthesize(String text) Prepare sound from textstatic voidWait for initialization to complete.
-
Constructor Details
-
SoundSynthHelper
public SoundSynthHelper()
-
-
Method Details
-
initialize
public static void initialize()Perform initialization. Called once during startup. Add-ons should not call it. -
waitUntilInitialized
Wait for initialization to complete. Not relevant for add-ons, by the time add-on is loaded it's already complete.- Throws:
InterruptedException
-
synthesize
Prepare sound from text- Parameters:
text- will be converted into sound- Returns:
- bytes that can be fed to
AudioSystem.getAudioFileFormat(java.io.InputStream)(after wrapping inByteArrayInputStream)
-
say
Synthesize and say immediately. Mostly useful for debug. For addons it's better to useLayer1ApiSoundAlertMessageandsynthesize(String)instead (this will prevent overlapping, for example)- Parameters:
text- will be converted into sound
-