Skip to content

Commit b6f4346

Browse files
Merge pull request #225994 from eric-urban/eur/qs-rest
rest by platform
2 parents 11aac96 + 1bcc218 commit b6f4346

File tree

2 files changed

+68
-2
lines changed
  • articles/cognitive-services/Speech-Service/includes/quickstarts

2 files changed

+68
-2
lines changed

articles/cognitive-services/Speech-Service/includes/quickstarts/speech-to-text-basics/rest.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ You will also need a `.wav` audio file on your local machine. You can use your o
2424

2525
At a command prompt, run the following cURL command. Replace `YourAudioFile.wav` with the path and name of your audio file.
2626

27-
```console
27+
**Choose your target environment**
28+
29+
# [Windows](#tab/windows)
30+
31+
```terminal
2832
audio_file=@'YourAudioFile.wav'
2933
3034
curl --location --request POST \
@@ -34,6 +38,32 @@ curl --location --request POST \
3438
--data-binary $audio_file
3539
```
3640

41+
# [Linux](#tab/linux)
42+
43+
```terminal
44+
audio_file=@'YourAudioFile.wav'
45+
46+
curl --location --request POST \
47+
"https://${SPEECH_REGION}.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en-US" ^
48+
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" ^
49+
--header "Content-Type: audio/wav" ^
50+
--data-binary $audio_file
51+
```
52+
53+
# [macOS](#tab/macos)
54+
55+
```terminal
56+
audio_file=@'YourAudioFile.wav'
57+
58+
curl --location --request POST \
59+
"https://${SPEECH_REGION}.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en-US" ^
60+
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" ^
61+
--header "Content-Type: audio/wav" ^
62+
--data-binary $audio_file
63+
```
64+
65+
* * *
66+
3767
> [!IMPORTANT]
3868
> Make sure that you set the `SPEECH__KEY` and `SPEECH__REGION` environment variables as described [above](#set-environment-variables). If you don't set these variables, the sample will fail with an error message.
3969

articles/cognitive-services/Speech-Service/includes/quickstarts/text-to-speech-basics/rest.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ ms.author: eur
2222

2323
At a command prompt, run the following cURL command. Optionally you can rename `output.mp3` to another output filename.
2424

25-
```console
25+
**Choose your target environment**
26+
27+
# [Windows](#tab/windows)
28+
29+
```terminal
2630
curl --location --request POST "https://${SPEECH_REGION}.tts.speech.microsoft.com/cognitiveservices/v1" \
2731
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" \
2832
--header 'Content-Type: application/ssml+xml' \
@@ -35,6 +39,38 @@ curl --location --request POST "https://${SPEECH_REGION}.tts.speech.microsoft.co
3539
</speak>' > output.mp3
3640
```
3741

42+
# [Linux](#tab/linux)
43+
44+
```terminal
45+
curl --location --request POST "https://${SPEECH_REGION}.tts.speech.microsoft.com/cognitiveservices/v1" ^
46+
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" ^
47+
--header 'Content-Type: application/ssml+xml' ^
48+
--header 'X-Microsoft-OutputFormat: audio-16khz-128kbitrate-mono-mp3' ^
49+
--header 'User-Agent: curl' ^
50+
--data-raw '<speak version='\''1.0'\'' xml:lang='\''en-US'\''>
51+
<voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-JennyNeural'\''>
52+
my voice is my passport verify me
53+
</voice>
54+
</speak>' > output.mp3
55+
```
56+
57+
# [macOS](#tab/macos)
58+
59+
```terminal
60+
curl --location --request POST "https://${SPEECH_REGION}.tts.speech.microsoft.com/cognitiveservices/v1" ^
61+
--header "Ocp-Apim-Subscription-Key: ${SPEECH_KEY}" ^
62+
--header 'Content-Type: application/ssml+xml' ^
63+
--header 'X-Microsoft-OutputFormat: audio-16khz-128kbitrate-mono-mp3' ^
64+
--header 'User-Agent: curl' ^
65+
--data-raw '<speak version='\''1.0'\'' xml:lang='\''en-US'\''>
66+
<voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-JennyNeural'\''>
67+
my voice is my passport verify me
68+
</voice>
69+
</speak>' > output.mp3
70+
```
71+
72+
* * *
73+
3874
> [!IMPORTANT]
3975
> Make sure that you set the `SPEECH__KEY` and `SPEECH__REGION` environment variables as described [above](#set-environment-variables). If you don't set these variables, the sample will fail with an error message.
4076

0 commit comments

Comments
 (0)