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
pipelineResponseBhashiniComputeResponseThe current BhashiniComputeResponse.
Returns
- string
The transcribed text.
GetTextToSpeechResult(BhashiniComputeResponse)
Gets the audio from a BhashiniComputeResponse.
public static Task<AudioClip> GetTextToSpeechResult(this BhashiniComputeResponse pipelineResponse)
Parameters
pipelineResponseBhashiniComputeResponseThe 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
pipelineResponseBhashiniComputeResponseThe 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
pipelineDataBhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
sourceLanguagestringThe language of the speech. If null, takes it from the BhashiniPipelineTaskConfiguration.
audioFormatBhashiniAudioFormatThe format the audio should be sent in, defaults to Wav.
sampleRateintThe 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
pipelineDataBhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
voiceTypeBhashiniVoiceTypeThe voice type. If not given, takes the first available one from the BhashiniPipelineTaskConfiguration.
sourceLanguagestringThe 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
pipelineDataBhashiniPipelineTaskConfigurationThe current BhashiniPipelineTaskConfiguration.
sourceLanguagestringThe language of the input text. If null, takes it from the BhashiniPipelineTaskConfiguration.
targetLanguagestringThe language of the output text. If null, takes it from the BhashiniPipelineTaskConfiguration.
Returns
- BhashiniComputeTask
A configured BhashiniComputeTask object.