Class StreamingTTSComponent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.tts.StreamingTTSComponent
All Implemented Interfaces:
SpeechProductionInterface

public class StreamingTTSComponent extends DiarcComponent implements SpeechProductionInterface
Streaming TTS behind a pluggable synthesis backend (kokoro by default). The LLM streaming path pushes phrase fragments via pushStreamingSpeech/endStreamingSpeech; the backend turns one phrase into PCM and nothing else.
  • Constructor Details

    • StreamingTTSComponent

      public StreamingTTSComponent()
  • Method Details

    • additionalUsageInfo

      protected List<org.apache.commons.cli.Option> additionalUsageInfo()
      Description copied from class: DiarcComponent
      Override this method to define command line options available in sub-class. This should be paired with a parseArgs implementation.
      Overrides:
      additionalUsageInfo in class DiarcComponent
      Returns:
    • parseArgs

      protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine)
      Description copied from class: DiarcComponent
      Override this method to parse command line args in the sub-class. Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.
      Overrides:
      parseArgs in class DiarcComponent
    • init

      protected void init()
      Description copied from class: DiarcComponent
      Perform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.
      Overrides:
      init in class DiarcComponent
    • shutdownComponent

      protected void shutdownComponent()
      Description copied from class: DiarcComponent
      Any component that needs particular shutdown logic needs to override this method and
      Overrides:
      shutdownComponent in class DiarcComponent
    • sayText

      public boolean sayText(String text)
      Description copied from interface: SpeechProductionInterface
      Speaks appropriate text, blocking.
      Specified by:
      sayText in interface SpeechProductionInterface
      Parameters:
      text - the text to be spoken
    • sayText

      public boolean sayText(String text, boolean wait)
      Description copied from interface: SpeechProductionInterface
      Speaks appropriate text
      Specified by:
      sayText in interface SpeechProductionInterface
      Parameters:
      text - the text to be spoken
      wait - whether or not to block until speaking call returns
    • pushStreamingSpeech

      public void pushStreamingSpeech(String fragment)
    • pushStreamingSpeech

      public void pushStreamingSpeech(String fragment, long uid)
    • unbufferStreamingTTSOutputForUID

      public void unbufferStreamingTTSOutputForUID(long uid)
    • cancelStreamingTTSOutputForUID

      public void cancelStreamingTTSOutputForUID(long uid)
    • endStreamingSpeech

      public boolean endStreamingSpeech(boolean wait)
    • endStreamingSpeech

      public boolean endStreamingSpeech(boolean wait, long uid)
    • waitForStreamingSpeechCompletion

      public void waitForStreamingSpeechCompletion(long uid)
    • isStreamingSpeech

      public boolean isStreamingSpeech(long uid)
    • isSpeaking

      public boolean isSpeaking()
      Description copied from interface: SpeechProductionInterface
      Checks if speech is being produced.
      Specified by:
      isSpeaking in interface SpeechProductionInterface
      Returns:
      true if speech is being produced, false otherwise
    • stopUtterance

      public boolean stopUtterance()
      Description copied from interface: SpeechProductionInterface
      Stops an ongoing utterance.
      Specified by:
      stopUtterance in interface SpeechProductionInterface
      Returns:
      true if speech is interrupted, false otherwise.
    • armPostStreamRearm

      public void armPostStreamRearm()
    • playAudioClip

      public void playAudioClip(String path)
    • toggleVoiceOn

      public void toggleVoiceOn()
    • toggleVoiceOff

      public void toggleVoiceOff()
    • setVoiceVolume

      public boolean setVoiceVolume(Symbol volumeSymbol)
    • setVoiceVolume

      public boolean setVoiceVolume(int percent)
    • lowerVoiceVolume

      public boolean lowerVoiceVolume()
    • raiseVoiceVolume

      public boolean raiseVoiceVolume()
    • getVoiceVolume

      public int getVoiceVolume()