You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/README.md
+16-51Lines changed: 16 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Azure AI Speech Transcription client library for Java
2
2
3
-
The Azure AI Speech Transcription client library provides a simple and efficient way to convert audio to text using Azure Cognitive Services. This library enables you to transcribe audio files with features like speaker diarization, profanity filtering, and phrase hints for improved accuracy.
3
+
The Azure AI Speech Transcription client library provides a simple and efficient way to convert audio to text using Azure Cognitive Services. This library enables you to transcribe audio with features like speaker diarization, profanity filtering, and phrase hints for improved accuracy.
4
4
5
5
## Documentation
6
6
@@ -30,9 +30,9 @@ Various documentation is available to help you get started:
30
30
```
31
31
[//]: #({x-version-update-end})
32
32
33
-
#### Optional: For Azure AD Authentication
33
+
#### Optional: For Entra ID Authentication
34
34
35
-
If you plan to use Azure AD authentication (recommended for production), also add the `azure-identity` dependency:
35
+
If you plan to use Entra ID authentication (recommended for production), also add the `azure-identity` dependency:
36
36
37
37
```xml
38
38
<dependency>
@@ -65,11 +65,9 @@ TranscriptionClient client = new TranscriptionClientBuilder()
65
65
.buildClient();
66
66
```
67
67
68
-
#### Option 2: Azure AD OAuth2 Authentication (Recommended for Production)
68
+
#### Option 2: Entra ID OAuth2 Authentication (Recommended for Production)
69
69
70
-
For production scenarios, it's recommended to use Azure Active Directory (Azure AD) authentication with managed identities or service principals. This provides better security and easier credential management.
71
-
72
-
The OAuth2 scope for Azure Cognitive Services is: `https://cognitiveservices.azure.com/.default`
70
+
For production scenarios, it's recommended to use Entra ID authentication with managed identities or service principals. This provides better security and easier credential management.
73
71
74
72
```java
75
73
importcom.azure.identity.DefaultAzureCredential;
@@ -84,28 +82,28 @@ TranscriptionClient client = new TranscriptionClientBuilder()
84
82
.buildClient();
85
83
```
86
84
87
-
**Note:** To use Azure AD authentication, you need to:
85
+
**Note:** To use Entra ID authentication, you need to:
88
86
1. Add the `azure-identity` dependency to your project
89
87
2. Assign the appropriate role (e.g., "Cognitive Services User") to your managed identity or service principal
90
-
3. Ensure your Cognitive Services resource has Azure AD authentication enabled
88
+
3. Ensure your Cognitive Services resource has Entra ID authentication enabled
91
89
92
-
For more information on Azure AD authentication, see:
90
+
For more information on Entra ID authentication, see:
93
91
-[Authenticate with Azure Identity](https://learn.microsoft.com/azure/developer/java/sdk/identity)
The `TranscriptionClient` is the primary interface for interacting with the Speech Transcription service. It provides methods to transcribe audio files to text.
98
+
The `TranscriptionClient` is the primary interface for interacting with the Speech Transcription service. It provides methods to transcribe audio to text.
101
99
102
100
### TranscriptionAsyncClient
103
101
104
102
The `TranscriptionAsyncClient` provides asynchronous methods for transcribing audio, allowing non-blocking operations that return reactive types.
105
103
106
104
### Audio Formats
107
105
108
-
The service supports various audio formats including WAV, MP3, OGG, and more. Audio files must be:
106
+
The service supports various audio formats including WAV, MP3, OGG, and more. Audio must be:
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/customization/src/main/java/SpeechTranscriptionCustomization.java
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/main/java/com/azure/ai/speech/transcription/TranscriptionAsyncClient.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ public final class TranscriptionAsyncClient {
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/main/java/com/azure/ai/speech/transcription/TranscriptionClient.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ public final class TranscriptionClient {
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/main/java/com/azure/ai/speech/transcription/models/AudioFileDetails.java
+25-3Lines changed: 25 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -52,13 +52,35 @@ public BinaryData getContent() {
52
52
}
53
53
54
54
/**
55
-
* Get the filename property: The filename of the file.
55
+
* Get the filename property: The filename of the file. If not explicitly set, a filename will be auto-generated
56
+
* from the contentType.
56
57
*
57
-
* @return the filename value.
58
+
* @return the filename value, or an auto-generated filename if not set.
58
59
*/
59
60
@Generated
60
61
publicStringgetFilename() {
61
-
returnthis.filename;
62
+
if (this.filename != null && !this.filename.isEmpty()) {
63
+
returnthis.filename;
64
+
}
65
+
if ("audio/wav".equalsIgnoreCase(this.contentType)) {
66
+
return"audio.wav";
67
+
}
68
+
if ("audio/mpeg".equalsIgnoreCase(this.contentType) || "audio/mp3".equalsIgnoreCase(this.contentType)) {
69
+
return"audio.mp3";
70
+
}
71
+
if ("audio/ogg".equalsIgnoreCase(this.contentType)) {
72
+
return"audio.ogg";
73
+
}
74
+
if ("audio/flac".equalsIgnoreCase(this.contentType)) {
75
+
return"audio.flac";
76
+
}
77
+
if ("audio/webm".equalsIgnoreCase(this.contentType)) {
78
+
return"audio.webm";
79
+
}
80
+
if ("audio/opus".equalsIgnoreCase(this.contentType)) {
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/main/java/com/azure/ai/speech/transcription/models/EnhancedModeOptions.java
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/samples/java/com/azure/ai/speech/transcription/EnhancedModeSample.java
Copy file name to clipboardExpand all lines: sdk/cognitiveservices/azure-ai-speech-transcription/src/samples/java/com/azure/ai/speech/transcription/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ To run these samples, you need:
10
10
2.**Azure AI Speech Service Resource**: Create one in the [Azure Portal](https://portal.azure.com)
11
11
3.**Authentication**: Choose one of the following authentication methods:
12
12
13
-
### Option 1: Azure AD Authentication (Recommended for Production)
14
-
15
-
Set the endpoint and configure Azure AD credentials:
13
+
### Option 1: Entra ID Authentication (Recommended for Production)
14
+
15
+
Set the endpoint and configure Entra ID credentials:
16
16
17
17
```bash
18
18
set SPEECH_ENDPOINT=https://your-resource-name.cognitiveservices.azure.com/
**Required dependency** for Azure AD authentication:
67
+
**Required dependency** for Entra ID authentication:
68
68
69
69
```xml
70
70
<dependency>
@@ -80,10 +80,10 @@ To run these samples, you need:
80
80
81
81
All samples in this directory support **both authentication methods**:
82
82
83
-
-**Azure AD (TokenCredential)**: Uses `DefaultAzureCredential` from azure-identity
83
+
-**Entra ID (TokenCredential)**: Uses `DefaultAzureCredential` from azure-identity
84
84
-**API Key (KeyCredential)**: Uses the `SPEECH_API_KEY` environment variable
85
85
86
-
The samples will automatically detect which authentication method to use based on the environment variables you've set. If `SPEECH_API_KEY` is set, it will use API Key authentication; otherwise, it will attempt Azure AD authentication.
86
+
The samples will automatically detect which authentication method to use based on the environment variables you've set. If `SPEECH_API_KEY` is set, it will use API Key authentication; otherwise, it will attempt Entra ID authentication.
0 commit comments