Class AudioHelper

java.lang.Object
com.intellijava.core.utils.AudioHelper

public class AudioHelper extends Object
AudioHelper is a class to process and test the generated audio from speech synthesis models. It is recommended to play the generated audio using a suitable java third-party audio library and use this class only to decode the base64 model output.
Author:
github.com/Barqawiz
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
    global AudioHelper variable to print the logs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default AudioHelper constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(String audioContent)
    decode base64 audio string and convert to audio byte array.
    static void
    clean the temporary audio files.
    static boolean
    saveTempAudio(byte[] decodedAudio)
    save temporary audio files.
    static boolean
    update the global location to save temporary audio files.

    Methods inherited from class java.lang.Object

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

    • isLog

      public static boolean isLog
      global AudioHelper variable to print the logs.
  • Constructor Details

    • AudioHelper

      public AudioHelper()
      Default AudioHelper constructor.
  • Method Details

    • decode

      public static byte[] decode(String audioContent)
      decode base64 audio string and convert to audio byte array.
      Parameters:
      audioContent - based64 format audio.
      Returns:
      audio byte array
    • updateGlobalTempLocation

      public static boolean updateGlobalTempLocation(String fileTempAudio)
      update the global location to save temporary audio files.
      Parameters:
      fileTempAudio - file path and name.
      Returns:
      status true or false.
    • saveTempAudio

      public static boolean saveTempAudio(byte[] decodedAudio)
      save temporary audio files. This function created for testing purposes, it is recommended to use third party libraries for audio processing.
      Parameters:
      decodedAudio - audio byte format.
      Returns:
      saving status
    • deleteTempAudio

      public static void deleteTempAudio()
      clean the temporary audio files.