Package com.intellijava.core.utils
Class AudioHelper
java.lang.Object
com.intellijava.core.utils.AudioHelper
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
Modifier and TypeFieldDescriptionstatic boolean
global AudioHelper variable to print the logs. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
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
updateGlobalTempLocation
(String fileTempAudio) update the global location to save temporary audio files.
-
Field Details
-
isLog
public static boolean isLogglobal AudioHelper variable to print the logs.
-
-
Constructor Details
-
AudioHelper
public AudioHelper()Default AudioHelper constructor.
-
-
Method Details
-
decode
decode base64 audio string and convert to audio byte array.- Parameters:
audioContent
- based64 format audio.- Returns:
- audio byte array
-
updateGlobalTempLocation
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.
-