Skip to content

Commit 379f8e1

Browse files
committed
correct links
1 parent b9fc3d5 commit 379f8e1

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

articles/cognitive-services/Speech-Service/includes/common/azure-prerequisites-clu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.author: eur
99

1010
> [!div class="checklist"]
1111
> * Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
12-
> * [Create a Language resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics)Create a Language resource</a> in the Azure portal.
12+
> * [Create a Language resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics) in the Azure portal.
1313
> * Get the Language resource key and endpoint. After your Language resource is deployed, select **Go to resource** to view and manage keys. For more information about Cognitive Services resources, see [Get the keys for your resource](~/articles/cognitive-services/cognitive-services-apis-create-account.md#get-the-keys-for-your-resource).
1414
> * [Create a Speech resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices) in the Azure portal.
1515
> * Get the Speech resource key and region. After your Speech resource is deployed, select **Go to resource** to view and manage keys. For more information about Cognitive Services resources, see [Get the keys for your resource](~/articles/cognitive-services/cognitive-services-apis-create-account.md#get-the-keys-for-your-resource).

articles/cognitive-services/Speech-Service/includes/how-to/compressed-audio-input/java.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: cognitive-services
44
ms.topic: include
5-
ms.date: 03/11/2020
5+
ms.date: 02/28/2023
66
ms.custom: devx-track-java
77
ms.author: eur
88
---
@@ -35,32 +35,13 @@ Choose a platform for installation instructions.
3535

3636
## Example
3737

38-
To configure the Speech SDK to accept compressed audio input, create a `PullAudioInputStream` or `PushAudioInputStream`. Then, create an `AudioConfig` from an instance of your stream class that specifies the compression format of the stream. Find related sample code in [Speech SDK samples](https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/java/jre/console/src/com/microsoft/cognitiveservices/speech/samples/console/WavStream.java).
38+
To configure the Speech SDK to accept compressed audio input, create a `PullAudioInputStream` or `PushAudioInputStream`. Then, create an `AudioConfig` from an instance of your stream class that specifies the compression format of the stream. Find related sample code in [Speech SDK samples](https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/java/android/compressed-input/app/src/main/java/com/microsoft/cognitiveservices/speech/samples/compressedinput/MainActivity.java).
3939

40-
Let's assume that you have an input stream class called `pullStream` and are using OPUS/OGG. Your code might look like this:
40+
Let's assume that you have an input stream class called `pullAudio` and are using MP3. Your code might look like this:
4141

4242
```java
43-
import com.microsoft.cognitiveservices.speech.audio.AudioConfig;
44-
import com.microsoft.cognitiveservices.speech.audio.AudioInputStream;
45-
import com.microsoft.cognitiveservices.speech.audio.AudioStreamFormat;
46-
import com.microsoft.cognitiveservices.speech.audio.PullAudioInputStream;
47-
import com.microsoft.cognitiveservices.speech.audio.AudioStreamContainerFormat;
48-
49-
// ... omitted for brevity
50-
51-
SpeechConfig speechConfig =
52-
SpeechConfig.fromSubscription(
53-
"YourSubscriptionKey",
54-
"YourServiceRegion");
55-
56-
// Create an audio config specifying the compressed
57-
// audio format and the instance of your input stream class.
58-
PullAudioInputStream pullStream = AudioInputStream.createPullStream(
59-
AudioStreamFormat.getCompressedFormat(AudioStreamContainerFormat.OGG_OPUS));
60-
AudioConfig audioConfig = AudioConfig.fromStreamInput(pullStream);
61-
62-
SpeechRecognizer recognizer = new SpeechRecognizer(speechConfig, audioConfig);
63-
SpeechRecognitionResult result = recognizer.recognizeOnceAsync().get();
64-
65-
String text = result.getText();
43+
String filePath = "whatstheweatherlike.mp3";
44+
PullAudioInputStream pullAudio = AudioInputStream.createPullStream(new BinaryAudioStreamReader(filePath),
45+
AudioStreamFormat.getCompressedFormat(AudioStreamContainerFormat.MP3));
46+
AudioConfig audioConfig = AudioConfig.fromStreamInput(pullAudio);
6647
```

0 commit comments

Comments
 (0)