Class PipelineComputationExtensions
QOL extensions for pipeline computation tasks and results.
public static class PipelineComputationExtensions
- Inheritance
-
objectPipelineComputationExtensions
Methods
GetSpeechToTextResult(BhashiniComputeResponse)
Gets the transcribed text from a BhashiniComputeResponse.
public static string GetSpeechToTextResult(this BhashiniComputeResponse pipelineResponse)
Parameters
pipelineResponse
BhashiniComputeResponseThe current BhashiniComputeResponse.
Returns
- string
The transcribed text.
GetTextToSpeechResult(BhashiniComputeResponse)
Gets the audio from a BhashiniComputeResponse.
public static Task<AudioClip> GetTextToSpeechResult(this BhashiniComputeResponse pipelineResponse)
Parameters
pipelineResponse
BhashiniComputeResponseThe current BhashiniComputeResponse.
Returns
- Task<AudioClip>
The synthesized audio.
Remarks
This method only supports Wav, Mp3 and Pcm*.
*Utilities.Audio is required.
GetTranslateResult(BhashiniComputeResponse)
Gets the translated text from a BhashiniComputeResponse.
public static string GetTranslateResult(this BhashiniComputeResponse pipelineResponse)
Parameters
pipelineResponse
BhashiniComputeResponseThe current BhashiniComputeResponse.
Returns
- string
The translated text.
ToSpeechToTextTask(BhashiniPipelineTaskConfiguration, string, BhashiniAudioFormat, int)
Converts the current BhashiniPipelineTaskConfiguration to an STT BhashiniComputeTask.
public static BhashiniComputeTask ToSpeechToTextTask(this BhashiniPipelineTaskConfiguration pipelineData, string sourceLanguage = null, BhashiniAudioFormat audioFormat = BhashiniAudioFormat.Wav, int sampleRate = 44100)
Parameters
pipelineData
BhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
sourceLanguage
stringThe language of the speech. If null, takes it from the BhashiniPipelineTaskConfiguration.
audioFormat
BhashiniAudioFormatThe format the audio should be sent in, defaults to Wav.
sampleRate
intThe sample rate of the audio, defaults to 44100.
Returns
- BhashiniComputeTask
A configured BhashiniComputeTask object.
ToTextToSpeechTask(BhashiniPipelineTaskConfiguration, BhashiniVoiceType, string)
Converts the current BhashiniPipelineTaskConfiguration to a TTS BhashiniComputeTask.
public static BhashiniComputeTask ToTextToSpeechTask(this BhashiniPipelineTaskConfiguration pipelineData, BhashiniVoiceType voiceType = BhashiniVoiceType.Default, string sourceLanguage = null)
Parameters
pipelineData
BhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
voiceType
BhashiniVoiceTypeThe voice type. If not given, takes the first available one from the BhashiniPipelineTaskConfiguration.
sourceLanguage
stringThe language of the text. If null, takes it from the BhashiniPipelineTaskConfiguration.
Returns
- BhashiniComputeTask
A configured BhashiniComputeTask object.
ToTranslateTask(BhashiniPipelineTaskConfiguration, string, string)
Converts the current BhashiniPipelineTaskConfiguration to a translation BhashiniComputeTask.
public static BhashiniComputeTask ToTranslateTask(this BhashiniPipelineTaskConfiguration pipelineData, string sourceLanguage = null, string targetLanguage = null)
Parameters
pipelineData
BhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
sourceLanguage
stringThe language of the input text. If null, takes it from the BhashiniPipelineTaskConfiguration.
targetLanguage
stringThe language of the output text. If null, takes it from the BhashiniPipelineTaskConfiguration.
Returns
- BhashiniComputeTask
A configured BhashiniComputeTask object.