Getting Started with ASP.NET Core Speech To Text control
23 Jul 20264 minutes to read
This section explains how to include the ASP.NET Core Speech To Text control in your ASP.NET Core application using Visual Studio.
Create an ASP.NET Core Web App with Razor pages
Create an ASP.NET Core Web App using Visual Studio via Microsoft Templates or the Syncfusion® ASP.NET Core Extension. For detailed instructions, refer to the ASP.NET Core Web App Getting Started documentation.
Install the required ASP.NET Core packages
To add ASP.NET Core Speech To Text control in the app, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search for and install the Syncfusion.AspNetCore.Inputs and Syncfusion.AspNetCore.Themes packages. All Syncfusion ASP.NET Core packages are available on nuget.org. See the NuGet packages topic for details.
Alternatively, you can install the same packages using the Package Manager Console with the following command.
Install-Package Syncfusion.AspNetCore.Inputs -Version 34.1.29
Install-Package Syncfusion.AspNetCore.Themes -Version 34.1.29Add ASP.NET Core Tag Helpers
After the packages are installed, open the ~/Pages/_ViewImports.cshtml file and import the Syncfusion.AspNetCore.Base and Syncfusion.AspNetCore.Inputs Tag Helpers.
@addTagHelper *, Syncfusion.AspNetCore.Base
@addTagHelper *, Syncfusion.AspNetCore.InputsAdd stylesheet and script resources
The theme stylesheet and script can be referenced from CDN. Include the stylesheet and script references inside the <head> of ~/Pages/Shared/_Layout.cshtml file.
<head>
...
@* ASP.NET Core controls styles *@
<link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
@* ASP.NET Core controls scripts *@
<script src="_content/Syncfusion.AspNetCore.Inputs/scripts/sf-speech-to-text.min.js"></script>
</head>Register the Script Manager
Open the ~/Pages/Shared/_Layout.cshtml file and register the script manager <ejs-scripts> at the end of the <body> element as follows.
<body>
...
@* ASP.NET Core Script Manager *@
<ejs-scripts></ejs-scripts>
</body>Add ASP.NET Core Speech To Text control
Add the ASP.NET Core Speech To Text control in the ~/Pages/Index.cshtml file.
@using Syncfusion.EJ2.Inputs
<div id='speechtotext-container'>
<ejs-speechtotext id="speech-to-text" transcriptChanged="onTranscriptChanged"></ejs-speechtotext>
<ejs-textarea id="output-textarea" rows="5" cols="50" value="" resizeMode="None" placeholder="Transcribed text will be shown here..."></ejs-textarea>
</div>
<script>
function onTranscriptChanged(args) {
var textareaObj = ej.base.getComponent(document.getElementById("output-textarea"), "textarea");
textareaObj.value = args.transcript;
}
</script>
<style>
#speechtotext-container {
gap: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
</style>Run the application
Press Ctrl+F5 (Windows) or ⌘+F5 (macOS) to launch the application. The ASP.NET Core Speech To Text control will render in your default web browser.

Adding button content
You can use the content property to display the start listening text and stopContent to display the stop listening text by using the e-speechtotext-buttonSettings tag helper.
@using Syncfusion.EJ2.Inputs
<div id='speechtotext-container'>
<ejs-speechtotext id="speech-to-text" transcriptChanged="onTranscriptChanged">
<e-speechtotext-buttonSettings content="Start Listening" stopContent="Stop Listening"></e-speechtotext-buttonSettings>
</ejs-speechtotext>
<ejs-textarea id="output-textarea" rows="5" cols="50" value="" resizeMode="None" placeholder="Transcribed text will be shown here..."></ejs-textarea>
</div>
<script>
function onTranscriptChanged(args) {
var textareaObj = ej.base.getComponent(document.getElementById("output-textarea"), "textarea");
textareaObj.value = args.transcript;
}
</script>
<style>
#speechtotext-container {
gap: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
</style>
