Skip to content

Commit 4011662

Browse files
Merge pull request #1220 from telerik/didi/speachtotext
add initial articles for speechtotext button.
2 parents a9830b9 + 8c66e57 commit 4011662

File tree

17 files changed

+719
-4
lines changed

17 files changed

+719
-4
lines changed

_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@ navigation:
500500
position: 15
501501
## End SlideView Sub-Folders
502502
##End SlideView
503+
## SpeechToTextButton
504+
controls/speechtotextbutton:
505+
title: "SpeechToTextButton"
506+
## End SpeechToTextButton
503507
## SpreadProcessing
504508
controls/spreadprocessing:
505509
title: "SpreadProcessing"
@@ -751,6 +755,7 @@ intro_columns:
751755
"Segmented Control": "segmentedcontrol-overview"
752756
"Button": "button-overview"
753757
"CheckBox": "checkbox-overview"
758+
"SpeechToTextButton": "speechtotextbutton-overview"
754759
"TemplatedButton": "templatedbutton-overview"
755760
"ToggleButton": "togglebutton-overview"
756761
-

_contentTemplates/get-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ To visualize the Telerik controls, register them in the `MauiProgram.cs` file of
3737
.UseTelerik()
3838
<!-- Code omitted for brevity -->
3939
```
40+
4041
#end
4142

4243
#add-telerik-component

controls/bottomsheet/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ At the end, you will achieve the following result.
1818

1919
Before adding the BottomSheet, you need to:
2020

21-
1. [Set up your .NET MAUI application]({%slug maui-getting-started %}#step-1-set-up-your-net-maui-application).
21+
1. [Set up your .NET MAUI application]({%slug maui-getting-started%}#prerequisites).
2222

23-
1. [Download Telerik UI for .NET MAUI]({% slug maui-getting-started %}#step-2-download-telerik-ui-for-net-maui).
23+
1. [Download Telerik UI for .NET MAUI]({% slug maui-getting-started%}#step-0-start-your-free-trial).
2424

25-
1. [Install Telerik UI for .NET MAUI]({%slug maui-getting-started %}#step-3-install-telerik-ui-for-net-maui).
25+
1. [Install Telerik UI for .NET MAUI]({%slug maui-getting-started%}#step-3-add-the-telerik-nuGet-server).
2626

2727
## Define the Control
2828

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Commands
3+
page_title: .NET MAUI SpeechToTextButton Documentation - Commands
4+
description: Use the exposed commands of the Telerik UI for .NET MAUI SpeechToTextButton
5+
position: 9
6+
tags: .net maui, telerik speech to text button for .net maui, ui for .net maui, microsoft .net maui
7+
slug: speechtotextbutton-commands
8+
---
9+
10+
# .NET MAUI SpeechToTextButton Commands
11+
12+
The .NET MAUI SpeechToTextButton provides commands that execute when specific actions occur, such as when speech is recognized or when an error occurs. This allows you to handle these events in a more MVVM-friendly way.
13+
14+
The .NET MAUI SpeechToTextButton exposes the following commands:
15+
16+
* `SpeechRecognizedCommand` (`ICommand`)&mdash;Specifies a command to execute when the speech recognition is successful and the recognized text is available. The command context is `SpeechToTextButtonSpeechRecognizedCommandContext`, which contains the recognized text&mdash;`FullText` and confidence score&mdash;`FullTextConfidenceScore`.
17+
* `ErrorOccurredCommand` (`ICommand`)&mdash;Specifies a command to execute when an error occurs during the speech recognition process. The command context is `SpeechToTextButtonErrorOccurredCommandContext`, which contains the error message&mdash;`Message` and the exception&mdash;`Exception`.
18+
19+
## Example
20+
21+
Here is an example using the `SpeechRecognizedCommand` and `ErrorOccurredCommand`:
22+
23+
**1.** Define the `SpeechToTextButton` in XAML:
24+
25+
<snippet id='speechtotext-commands' />
26+
27+
**2.** Add the `telerik` namespace:
28+
29+
```XAML
30+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
31+
```
32+
33+
**3.** Define the `ViewModel` with `SpeechRecognizedCommand` and `ErrorOccurredCommand` definitions:
34+
35+
<snippet id='speechtotext-commands-viewmodel' />
36+
37+
> For a runnable example with the SpeechToTextButton Commands scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Features** category.
38+
39+
## See Also
40+
41+
- [Set Visual States]({%slug speechtotextbutton-visual-states%})
42+
- [Events]({%slug speechtotextbutton-events%})
43+
- [Custom Recognizer]({%slug speechtotextbutton-custom-recognizer%})
44+
- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%})
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Configuration
3+
page_title: .NET MAUI SpeechToTextButton Documentation - Configuration
4+
description: Learn how to define language, get the text from the speech to text recognizer when using the Telerik SpeechToTextButton for .NET MAUI.
5+
position: 5
6+
tags: .net maui, telerik speech to text button for .net maui, ui for .net maui, microsoft .net maui
7+
slug: speechtotextbutton-configuration
8+
---
9+
10+
# .NET MAUI SpeechToTextButton Configuration
11+
12+
The purpose of this help article is to show you the main configuration options of the control.
13+
14+
## Getting Full Text from Speech Recognition
15+
16+
The SpeechToTextButton allows you to retrieve the full text recognized by the speech recognition service.
17+
This is done through the `FullText` property, which provides the complete transcription of the spoken input from the beginning of the current listening session.
18+
19+
To get the full text, you can subscribe to the `SpeechRecognized` event, which is triggered when the speech recognition is successful.
20+
21+
## Continuous Recognition
22+
23+
The SpeechToTextButton supports continuous speech recognition, allowing it to listen for speech input without stopping after each recognition.
24+
25+
You can disable the continuous recognition by setting the `IsContinuousRecognition` property to `false`. The default value is `true`, meaning that the button will listen for speech input continuously, until it is explicitly stopped or the user taps the button again.
26+
27+
```XAML
28+
<telerik:RadSpeechToTextButton x:Name="speechContinuousButton"
29+
IsContinuousRecognition="False" />
30+
```
31+
32+
## Language
33+
34+
The SpeechToTextButton allows you to set the language for speech recognition. This is important for accurate transcription of spoken words into text.
35+
36+
You can set the language using the `LanguageTag` property, which accepts a string representing the language code (e.g., "en-US" for English, "fr-FR" for French).
37+
38+
<snippet id='speechtotext-language-tag' />
39+
40+
### Language Support
41+
42+
The SpeechToTextButton supports a variety of languages for speech recognition. The available languages depend on the underlying platform and the speech recognition service used.
43+
44+
Check the following articles for more information on supported languages: [SpeechToTextButton Language Support in .NET MAUI]({%slug speechtotextbutton-language-support%})
45+
46+
47+
> For a runnable example with the SpeechToTextButton Configuration scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Features** category.
48+
49+
## See Also
50+
51+
- [Set Visual States]({%slug speechtotextbutton-visual-states%})
52+
- [Execute Commands]({%slug speechtotextbutton-commands%})
53+
- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%})
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Custom Recognizer
3+
page_title: .NET MAUI SpeechToTextButton Documentation - Custom Recognizer
4+
description: Learn how to use a custom speech recognizer with the Telerik SpeechToTextButton for .NET MAUI.
5+
position: 6
6+
tags: .net maui, telerik speech to text button for .net maui, ui for .net maui, custom recognizer, microsoft .net maui
7+
slug: speechtotextbutton-custom-recognizer
8+
---
9+
10+
# .NET MAUI SpeechToTextButton Custom Recognizer
11+
12+
The .NET MAUI SpeechToTextButton allows you to use a custom speech recognizer by implementing the `IRadSpeechRecognizer` interface. This enables you to integrate third-party speech recognition services or customize the behavior of the speech recognition process.
13+
14+
## Implementation Steps
15+
16+
Follow these steps to implement a custom speech recognizer:
17+
18+
**1.** Define the `SpeechToTextButton` in XAML:
19+
20+
<snippet id='speechtotext-custom-recognizer' />
21+
22+
**2.** Add the `telerik` namespace:
23+
24+
```XAML
25+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
26+
```
27+
28+
**3.** Create a class `MyCustomSpeechRecognizer` that implements the `IRadSpeechRecognizer` interface:
29+
30+
<snippet id='speechtotext-mycustomrecognizer' />
31+
32+
**4.** Set the `SpeechRecognizerCreator` property of the `RadSpeechToTextButton` to an instance of your custom recognizer:
33+
34+
<snippet id='speechtotext-speech-recognizer-creator' />
35+
36+
**5.** Handle the `SpeechRecognized` event to process the recognition results:
37+
38+
<snippet id='speechtotext-events-speech-recognized' />
39+
40+
> For a runnable example with the SpeechToTextButton Custom Recognizer scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Features** category.
41+
42+
## See Also
43+
44+
- [Set Visual States]({%slug speechtotextbutton-visual-states%})
45+
- [Events]({%slug speechtotextbutton-events%})
46+
- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%})
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Events
3+
page_title: .NET MAUI SpeechToTextButton Documentation - Events
4+
description: Learn about the events that the SpeechToTextButton for .NET MAUI exposes.
5+
position: 8
6+
tags: .net maui, telerik speech to text button for .net maui, ui for .net maui
7+
slug: speechtotextbutton-events
8+
---
9+
10+
# .NET MAUI SpeechToTextButton Events
11+
12+
The .NET MAUI SpeechToTextButton emits a set of events that allow you to configure the component's behavior in response to speech recognition.
13+
14+
The .NET MAUI SpeechToTextButton exposes the following events:
15+
16+
* `SpeechRecognized`&mdash;Raised when the speech recognition is successful and the recognized text is available. The `SpeechRecognized` event handler receives two parameters:
17+
* The `sender` argument which is of type `object` but can be cast to `RadSpeechToTextButton`.
18+
* A `SpeechRecognizerSpeechRecognizedEventArgs` argument which has a reference to the:
19+
* `FullText` (`string`) property that contains the current full text recognized from the speech input from the beginning of the current listening session.
20+
* `FullTextConfidenceScore` property that indicates the confidence level of the recognition. The value is between 0 and 1, indicating how confident the speech-to-text transcription is. If the value is -1, a confidence score could not be provided.
21+
22+
* `ErrorOccurred`&mdash;Raised when an error occurs during the speech recognition process. The `ErrorOccurred` event handler receives two parameters:
23+
* The `sender` argument which is of type `object` but can be cast to `RadSpeechToTextButton`.
24+
* A `SpeechRecognizerErrorOccurredEventArgs` argument which has a reference to the:
25+
* `Message` (`string`) property that contains the error message describing the issue that occurred during speech recognition.
26+
* `Exception` (`System.Exception`) property that contains the exception associated with the speech recognizer error, if any.
27+
* `Handled` (`bool`) property that determines whether the error has been handled. Set this to `true` to prevent the default error handling behavior.
28+
29+
* `StateChanged`&mdash;Raised when the state of the speech recognizer changes. The `StateChanged` event handler receives two parameters:
30+
* The `sender` argument which is of type `object` but can be cast to `RadSpeechToTextButton`.
31+
* An `System.EventArgs`.
32+
33+
## Example
34+
35+
Here is an example using the `SpeechRecognized` and `ErrorOccurred` events:
36+
37+
**1.** Define the `SpeechToTextButton` in XAML:
38+
39+
<snippet id='speechtotext-events' />
40+
41+
**2.** Add the `telerik` namespace:
42+
43+
```XAML
44+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
45+
```
46+
47+
**3.** Handle the `SpeechRecognized` event:
48+
49+
<snippet id='speechtotext-events-speech-recognized' />
50+
51+
**4.** Handle the `ErrorOccurred` event:
52+
53+
<snippet id='speechtotext-events-error-occured' />
54+
55+
> For a runnable example with the SpeechToTextButton Events scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Features** category.
56+
57+
## See Also
58+
59+
- [Set Visual States]({%slug speechtotextbutton-visual-states%})
60+
- [Custom Recognizer]({%slug speechtotextbutton-custom-recognizer%})
61+
- [Execute Commands]({%slug speechtotextbutton-commands%})
62+
- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%})
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: Getting Started
3+
page_title: .NET MAUI SpeechToTextButton Documentation - Getting Started
4+
description: Get started with the Telerik UI for .NET MAUI SpeechToTextButton control and add the control to your .NET MAUI project.
5+
position: 2
6+
slug: speechtotextbutton-getting-started
7+
---
8+
9+
# Getting Started with the .NET MAUI SpeechToTextButton
10+
11+
This guide provides the information you need to start using the Telerik UI for .NET MAUI SpeechToTextButton by adding the control to your project.
12+
13+
At the end, you will achieve the following result.
14+
15+
![.NET MAUI SpeechToTextButton Getting Started](images/speechtotextbutton-getting-started.png)
16+
17+
## Prerequisites
18+
19+
Before adding the SpeechToTextButton, you need to:
20+
21+
1. [Set up your .NET MAUI application]({%slug maui-getting-started%}#prerequisites).
22+
23+
1. [Download Telerik UI for .NET MAUI]({% slug maui-getting-started%}#step-0-start-your-free-trial).
24+
25+
1. [Install Telerik UI for .NET MAUI]({%slug maui-getting-started%}#step-3-add-the-telerik-nuGet-server).
26+
27+
## Required Permissions
28+
29+
Before adding the contol, ensure that you have the required permissions set up in your project.
30+
31+
### Android
32+
33+
Add the following permissions to your `AndroidManifest.xml` file:
34+
35+
```xml
36+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
37+
```
38+
39+
### iOS and MacCatalyst
40+
41+
Add the `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` permissions to your `Info.plist` file:
42+
43+
```xml
44+
<key>NSMicrophoneUsageDescription</key>
45+
<string>The SpeechToTextButton requires access to microphone.</string>
46+
<key>NSSpeechRecognitionUsageDescription</key>
47+
<string>The SpeechToTextButton requires access to the Speech Recognition service.</string>
48+
```
49+
50+
### WinUI
51+
52+
There are limitations when using the SpeechToTextButton on WinUI. When clicking on the control, the `InvalidOperationException` occurs.
53+
54+
To turn speech recognition on WinUI, review the [WinUI Support]({%slug speechtotextbutton-winui-support%}) article.
55+
56+
## Define the Control
57+
58+
**1.** When your .NET MAUI application is set up, you are ready to add a SpeechToTextButton control to your page:
59+
60+
<snippet id='speechtotext-getting-started-xaml' />
61+
<snippet id='speechtotext-getting-started-csharp' />
62+
63+
**2.** Add the `telerik` namespace:
64+
65+
```XAML
66+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
67+
```
68+
```C#
69+
using Telerik.Maui.Controls;
70+
```
71+
72+
**3.** Register the Telerik controls through the `Telerik.Maui.Controls.Compatibility.UseTelerik` extension method called inside the `CreateMauiApp` method of the `MauiProgram.cs` file of your project:
73+
74+
```C#
75+
using Telerik.Maui.Controls.Compatibility;
76+
public static class MauiProgram
77+
{
78+
public static MauiApp CreateMauiApp()
79+
{
80+
var builder = MauiApp.CreateBuilder();
81+
builder
82+
.UseTelerik()
83+
.UseMauiApp<App>()
84+
.ConfigureFonts(fonts =>
85+
{
86+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
87+
});
88+
return builder.Build();
89+
}
90+
}
91+
```
92+
93+
> For a runnable example with the SpeechToTextButton Getting Started scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Getting Started** category.
94+
95+
## Additional Resources
96+
97+
- [Configure the SpeechToTextButton]({%slug speechtotextbutton-configuration%})
98+
- [Set Visual States]({%slug speechtotextbutton-visual-states%})
99+
- [Events]({%slug speechtotextbutton-events%})
100+
- [Execute Commands]({%slug speechtotextbutton-commands%})
101+
- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%})
102+
103+
## See Also
104+
105+
- [.NET MAUI SpeechToTextButton Product Page](https://www.telerik.com/maui-ui/speechtotextbutton)
106+
- [.NET MAUI SpeechToTextButton Forum Page](https://www.telerik.com/forums/maui?tagId=1764)
107+
- [Telerik .NET MAUI Blogs](https://www.telerik.com/blogs/mobile-net-maui)
108+
- [Telerik .NET MAUI Roadmap](https://www.telerik.com/support/whats-new/maui-ui/roadmap)
299 KB
Loading

0 commit comments

Comments
 (0)