Skip to content

Commit ec69901

Browse files
committed
considerations for compressed audio etc
1 parent 835b12a commit ec69901

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ Follow these steps to create a new console application for speech recognition.
4949
}
5050

5151
public static void recognizeFromMicrophone(SpeechConfig speechConfig) throws InterruptedException, ExecutionException {
52-
//To recognize speech from an audio file, use `fromWavFileInput` instead of `fromDefaultMicrophoneInput`:
53-
//AudioConfig audioConfig = AudioConfig.fromWavFileInput("YourAudioFile.wav");
5452
AudioConfig audioConfig = AudioConfig.fromDefaultMicrophoneInput();
5553
SpeechRecognizer speechRecognizer = new SpeechRecognizer(speechConfig, audioConfig);
5654

@@ -96,11 +94,18 @@ Speak into your microphone.
9694
RECOGNIZED: Text=I'm excited to try speech to text.
9795
```
9896

99-
This example uses the `RecognizeOnceAsync` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
100-
10197
> [!div class="nextstepaction"]
10298
> <a href="https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=JAVA&Pillar=Speech&Product=speech-to-text&Page=quickstart&Section=Recognize-speech-from-a-microphone" target="_target">I ran into an issue</a>
10399
100+
Here are some additional considerations:
101+
102+
- This example uses the `RecognizeOnceAsync` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
103+
- To recognize speech from an audio file, use `fromWavFileInput` instead of `fromDefaultMicrophoneInput`:
104+
```java
105+
AudioConfig audioConfig = AudioConfig.fromWavFileInput("YourAudioFile.wav");
106+
```
107+
- For compressed audio files such as MP4, install GStreamer and use `PullAudioInputStream` or `PushAudioInputStream`. For more information, see [How to use compressed audio files](~/articles/cognitive-services/speech-service/how-to-use-codec-compressed-audio-input-streams.md).
108+
104109
## Clean up resources
105110

106111
[!INCLUDE [Delete resource](../../common/delete-resource.md)]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ The speech from the audio file should be output as text:
9191
RECOGNIZED: Text=I'm excited to try speech to text.
9292
```
9393

94-
This example uses the `recognizeOnceAsync` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
95-
9694
> [!div class="nextstepaction"]
9795
> <a href="https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=JAVASCRIPT&Pillar=Speech&Product=speech-to-text&Page=quickstart&Section=Recognize-speech-from-a-file" target="_target">I ran into an issue</a>
9896
97+
This example uses the `recognizeOnceAsync` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
98+
9999
> [!NOTE]
100100
> Recognizing speech from a microphone is not supported in Node.js. It's supported only in a browser-based JavaScript environment. For more information, see the [React sample](https://github.com/Azure-Samples/AzureSpeechReactSample) and the [implementation of speech-to-text from a microphone](https://github.com/Azure-Samples/AzureSpeechReactSample/blob/main/src/App.js#L29) on GitHub. The React sample shows design patterns for the exchange and management of authentication tokens. It also shows the capture of audio from a microphone or file for speech-to-text conversions.
101101

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ Follow these steps to recognize speech in a macOS application.
4444
NSString *speechKey = @"YourSubscriptionKey";
4545
NSString *serviceRegion = @"YourServiceRegion";
4646

47-
//To recognize speech from an audio file, use `initWithWavFileInput` instead of `initWithMicrophone`:
48-
//SPXAudioConfiguration *audioConfig = [[SPXAudioConfiguration alloc] initWithWavFileInput:YourAudioFile];
4947
SPXAudioConfiguration *audioConfig = [[SPXAudioConfiguration alloc] initWithMicrophone:nil];
5048
SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithSubscription:speechKey region:serviceRegion];
5149
SPXSpeechRecognizer *speechRecognizer = [[SPXSpeechRecognizer alloc] initWithSpeechConfiguration:speechConfig language:@"en-US" audioConfiguration:audioConfig];
@@ -76,11 +74,16 @@ Follow these steps to recognize speech in a macOS application.
7674

7775
After you select the button in the app and say a few words, you should see the text you have spoken on the lower part of the screen. When you run the app for the first time, you should be prompted to give the app access to your computer's microphone.
7876

79-
This example uses the `recognizeOnce` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
80-
8177
> [!div class="nextstepaction"]
8278
> <a href="https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=OBJECTIVEC&Pillar=Speech&Product=speech-to-text&Page=quickstart&Section=Recognize-speech-from-a-microphone" target="_target">I ran into an issue</a>
8379
80+
Here are some additional considerations:
81+
82+
- This example uses the `recognizeOnce` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
83+
- To recognize speech from an audio file, use `initWithWavFileInput` instead of `initWithMicrophone`:
84+
```ObjectiveC
85+
SPXAudioConfiguration *audioConfig = [[SPXAudioConfiguration alloc] initWithWavFileInput:YourAudioFile];
86+
```
8487

8588
## Clean up resources
8689

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ RECOGNIZED: Text=I'm excited to try speech to text.
8888
> [!div class="nextstepaction"]
8989
> <a href="https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=PYTHON&Pillar=Speech&Product=speech-to-text&Page=quickstart&Section=Recognize-speech-from-a-microphone" target="_target">I ran into an issue</a>
9090
91+
Here are some additional considerations:
92+
93+
- This example uses the `recognize_once_async` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
94+
- To recognize speech from an audio file, use `filename` instead of `use_default_microphone`:
95+
```python
96+
audio_config = speechsdk.audio.AudioConfig(filename="YourAudioFile.wav")
97+
```
98+
- For compressed audio files such as MP4, install GStreamer and use `PullAudioInputStream` or `PushAudioInputStream`. For more information, see [How to use compressed audio files](~/articles/cognitive-services/speech-service/how-to-use-codec-compressed-audio-input-streams.md).
99+
91100
## Clean up resources
92101

93102
[!INCLUDE [Delete resource](../../common/delete-resource.md)]

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ Follow these steps to recognize speech in a macOS application.
128128

129129
After you select the button in the app and say a few words, you should see the text you have spoken on the lower part of the screen. When you run the app for the first time, you should be prompted to give the app access to your computer's microphone.
130130

131-
This example uses the `recognizeOnce` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
132-
133131
> [!div class="nextstepaction"]
134132
> <a href="https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=SWIFT&Pillar=Speech&Product=speech-to-text&Page=quickstart&Section=Recognize-speech-from-a-microphone" target="_target">I ran into an issue</a>
135133

134+
This example uses the `recognizeOnce` operation to transcribe utterances of up to 30 seconds, or until silence is detected. For information about continuous recognition for longer audio, including multi-lingual conversations, see [How to recognize speech](~/articles/cognitive-services/speech-service/how-to-recognize-speech.md).
136135

137136
## Clean up resources
138137

0 commit comments

Comments
 (0)