Skip to content

Commit 689180d

Browse files
authored
Merge pull request #7035 from bear385/patch-2
Update csharp.md with Live Interpreter sample code
2 parents af898fb + c04d8b6 commit 689180d

File tree

1 file changed

+32
-1
lines changed
  • articles/ai-services/speech-service/includes/how-to/translate-speech

1 file changed

+32
-1
lines changed

articles/ai-services/speech-service/includes/how-to/translate-speech/csharp.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ms.service: azure-ai-speech
44
ms.topic: include
55
ms.date: 1/21/2024
66
ms.author: pafarley
7-
ms.custom: devx-track-csharp
7+
ms.custom: devx-track-csharp, references_regions
88
---
99

1010
[!INCLUDE [Header](../../common/csharp.md)]
@@ -407,6 +407,37 @@ var translationRecognizer = new TranslationRecognizer(speechTranslationConfig, a
407407

408408
For a complete code sample with the Speech SDK, see [speech translation samples on GitHub](https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/csharp/sharedcontent/console/translation_samples.cs#L714).
409409

410+
## Using live interpreter (preview) for real-time speech-to-speech translation with personal voice
411+
412+
Live Interpreter continuously identifies the language being spoken without requiring you to set an input language and delivers low latency speech-to-speech translation in a natural voice that preserves the speaker’s style and tone.
413+
414+
To use the Live Interpreter API, first [apply for personal voice access](https://aka.ms/customneural) and select "Personal Voice" for Question 20. For resource ID, please make sure that it is in one of the following regions supported by the public preview:
415+
- West US 2
416+
- East US
417+
- Sweden Central
418+
- West Europe
419+
- Southeast Asia
420+
- Japan East
421+
422+
After personal voice access permission is granted, you can enable Live Interpreter with the following code:
423+
424+
```csharp
425+
// Please replace the service region with your region
426+
var v2EndpointInString = String.Format("wss://{0}.stt.speech.microsoft.com/speech/universal/v2", "YourRegion");
427+
var v2EndpointUrl = new Uri(v2EndpointInString);
428+
429+
// Creates an instance of a speech translation config with specified subscription key and service region.
430+
// Please replace the service subscription key with your subscription key
431+
var config = SpeechTranslationConfig.FromEndpoint(v2EndpointUrl, "YourSubscriptionKey");
432+
433+
// Translation target language and enable personal voice
434+
config.AddTargetLanguage("fr");
435+
config.VoiceName("personal-voice");
436+
437+
// You don't need to define any candidate languages to detect.
438+
var autoDetectSourceLanguageConfig = AutoDetectSourceLanguageConfig.FromOpenRange();
439+
```
440+
410441
## Using custom translation in speech translation
411442
The custom translation feature in speech translation seamlessly integrates with the Azure Custom Translation service, allowing you to achieve more accurate and tailored translations. As the integration directly harnesses the capabilities of the Azure custom translation service, you need to use a multi-service resource to ensure the correct functioning of the complete set of features. For detailed instructions, please consult the guide on [Create a multi-service resource for Azure AI services](/azure/ai-services/multi-service-resource?tabs=windows&pivots=azportal).
412443

0 commit comments

Comments
 (0)