Speech-to-text API
Use the speech-to-text API to transcribe voice messages.
Read time 1 minuteLast updated 7 months ago
Vivox uses the following speech-to-text transcription methods.
Enable or disable transcription
IVivoxService.SpeechToTextEnableTranscription
IVivoxService.SpeechToTextEnableTranscriptionawait VivoxService.Instance.SpeechToTextEnableTranscription( _channelName);
Use this method to enable the speech-to-text audio transcription feature inside a channel. This method takes the following parameter:
ChannelNameIVivoxService.SpeechToTextDisableTranscription
IVivoxService.SpeechToTextDisableTranscriptionawait VivoxService.Instance.SpeechToTextDisableTranscription( _channelName);
Use this method to disable the speech-to-text audio transcription feature inside a channel. This method takes the following parameter:
ChannelNameIVivoxService.IsSpeechToTextEnabled
IVivoxService.IsSpeechToTextEnabledbool isSpeechToTextEnabled = VivoxService.Instance.IsSpeechToTextEnabled(_channelName);
Use this method to check if the transcription is enabled or disabled inside a channel. This method takes the following parameter:
ChannelNameTranscription notification
IVivoxService.SpeechToTextMessageReceived
IVivoxService.SpeechToTextMessageReceivedVivoxService.Instance.SpeechToTextMessageReceived += OnSpeechTotextMessageAdded;VivoxService.Instance.SpeechToTextMessageReceived -= OnSpeechTotextMessageAdded;private void OnSpeechTotextMessageReceived(VivoxMessage message){ // Add your code here. “message” is the new transcribed message // added to the queue.}
Bind/Unbind this event handler to a method to receive a notification when a transcribed message is added.
Set transcription languages
LoginOptions.SpeechToTextLanguages
LoginOptions.SpeechToTextLanguagesloginOptions = loginOptions ?? new LoginOptions();loginOptions.SpeechToTextLanguages = new List<string>{"en", "es", "fr"};
A list of languages used as hints for audio transcription. The default is an empty array, which implies . You can specify up to three spoken languages in order of preference to inform the transcription of all users in transcribed channels. IETF language tag strings are not validated but are expected to conform to BCP47(RFC Editor).
en