Skip to main content

SoundSynthHelper

Package: velox.api.layer1.layers.utils

Type: Class

Inheritance: java.lang.Object รขโ€ โ€™ SoundSynthHelper

Descriptionโ€‹

Wrapper around TTS library. Use this if you need to generate sound from text.

Constructorsโ€‹

SoundSynthHelperโ€‹

public SoundSynthHelper()

Methodsโ€‹

initializeโ€‹

public static void initialize()

Perform initialization. Called once during startup. Add-ons should not call it.

waitUntilInitializedโ€‹

public static void waitUntilInitialized() throws InterruptedException

Wait for initialization to complete. Not relevant for add-ons, by the time add-on is loaded it's already complete.

Throws:

  • InterruptedException

synthesizeโ€‹

public static byte[] synthesize(String text)

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 in ByteArrayInputStream)

sayโ€‹

public static void say(String text)

Synthesize and say immediately. Mostly useful for debug. For addons it's better to use Layer1ApiSoundAlertMessage and synthesize(String) instead (this will prevent overlapping, for example)

Parameters:

  • text - Will be converted into sound