Class SoundSynthHelper

java.lang.Object
velox.api.layer1.layers.utils.SoundSynthHelper

public class SoundSynthHelper
extends java.lang.Object
Wrapper around TTS library. Use this if you need to generate sound from text.
  • Constructor Summary

    Constructors 
    Constructor Description
    SoundSynthHelper()  
  • Method Summary

    Modifier and Type Method Description
    static void initialize()
    Perform initialization.
    static void say​(java.lang.String text)
    Synthesize and say immediately.
    static byte[] synthesize​(java.lang.String text)
    Prepare sound from text
    static void waitUntilInitialized()
    Wait for initialization to complete.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • initialize

      public static void initialize()
      Perform initialization. Called once during startup. Add-ons should not call it.
    • waitUntilInitialized

      public static void waitUntilInitialized() throws java.lang.InterruptedException
      Wait for initialization to complete. Not relevant for add-ons, by the time add-on is loaded it's already complete.
      Throws:
      java.lang.InterruptedException
    • synthesize

      public static byte[] synthesize​(java.lang.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​(java.lang.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