agentsclimarketplace

Syncfusion javascript speech to text

Skill syncfusion/javascript-ui-controls-skills/skills/syncfusion-javascript-speech-to-text

This repository contains AI Skills of Javascript

Install
npx -y skills add syncfusion/javascript-ui-controls-skills --skill syncfusion-javascript-speech-to-text

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Implements the Syncfusion JavaScript SpeechToText control. Use this skill ALWAYS immediately for speech-to-text functionality, voice recognition, speech transcription, or microphone-based input in JavaScript applications. This skill provides guidance for implementing the SpeechToText control to transcribe spoken audio to text, handle speech recognition events, customize button appearance, set language options, manage listening states, and apply security best practices for voice input features.

SKILL.md

12.2 KB, ~2.5k tokens by cl100k_base, as published. Nobody here has run it

Syncfusion JavaScript SpeechToText Component

Overview

The Syncfusion JavaScript SpeechToText component is a button-based control that initiates speech recognition when clicked. It captures audio from the user's microphone, processes it through the browser's speech recognition service, and provides transcribed text through events and properties.

Key capabilities:

  • Real-time speech transcription with interim and final results
  • Configurable language support (en-US, fr-FR, de-DE, etc.)
  • Customizable button appearance, icons, and content
  • Tooltip configuration for start and stop states
  • Event-driven architecture (onStart, onStop, onError, transcriptChanged)
  • Programmatic control via startListening() and stopListening() methods
  • Localization support for 14+ UI text keys
  • RTL (Right-to-Left) layout support
  • Error handling for 8 common speech recognition errors
  • Security considerations for voice data privacy

Documentation and Navigation Guide

Getting Started

๐Ÿ“„ Read: references/getting-started.md

Start here for initial setup and basic implementation:

  • Installing dependencies (@syncfusion/ej2-inputs)
  • Setting up development environment
  • Importing CSS styles and themes
  • Creating basic SpeechToText button
  • Adding button content for start/stop states
  • Handling transcriptChanged event
  • Running your first speech recognition example

Speech Recognition Features

๐Ÿ“„ Read: references/speech-recognition.md

Core speech recognition functionality and configuration:

  • Retrieving transcripts from spoken audio
  • Setting recognition language (lang property)
  • Allowing interim results vs final results only
  • Managing listening states (Inactive, Listening, Stopped)
  • Showing or hiding tooltips
  • Disabling the component
  • Setting HTML attributes on the button element
  • Error handling for 8 error types (no-speech, audio-capture, not-allowed, etc.)
  • Browser support matrix and compatibility

Events

๐Ÿ“„ Read: references/events.md

Event handling for speech recognition lifecycle:

  • created event - Component initialization complete
  • onStart event - Speech recognition begins (StartListeningEventArgs)
  • onStop event - Speech recognition stops (StopListeningEventArgs)
  • onError event - Error occurs during recognition (ErrorEventArgs)
  • transcriptChanged event - Transcript updates (TranscriptChangedEventArgs)
  • Event configuration examples and patterns

Methods

๐Ÿ“„ Read: references/methods.md

Programmatic control of speech recognition:

  • startListening() - Initiate speech recognition programmatically
  • stopListening() - Terminate speech recognition programmatically
  • Using methods with custom buttons and controls
  • Method usage patterns and best practices

Appearance Customization

๐Ÿ“„ Read: references/appearance.md

Customizing button and tooltip appearance:

  • Button content (content, stopContent properties)
  • Button icons (iconCss, stopIconCss properties)
  • Icon positioning (top, bottom, left, right)
  • Primary button styling (isPrimary property)
  • Tooltip content and positioning
  • Applying CSS classes (e-primary, e-outline, e-info, e-success, e-warning, e-danger)
  • Custom styling with cssClass property

Globalization

๐Ÿ“„ Read: references/globalization.md

Localization and internationalization support:

  • Localization using L10n.load method
  • Default text identifiers (14 keys for error messages, tooltips, ARIA labels)
  • Configuring locale property
  • RTL (Right-to-Left) support with enableRtl property
  • RTL layout implementation for Arabic, Hebrew, Persian languages

Security Considerations

๐Ÿ“„ Read: references/security.md

Security and privacy best practices:

  • Online dependency requirements
  • Potential security risks (data transmission, privacy, MITM attacks)
  • Browser permission exploits
  • Mitigation strategies (HTTPS, trusted environments, explicit consent)
  • Data processing by third-party services

Quick Start Example

import { SpeechToText, TextArea, TranscriptChangedEventArgs } from "@syncfusion/ej2-inputs";

// Initialize SpeechToText component
const speechToText: SpeechToText = new SpeechToText({
    transcriptChanged: (args: TranscriptChangedEventArgs) => {
        // Update textarea with transcribed text
        textareaObj.value = args.transcript;
    }
});

// Render the component
speechToText.appendTo('#speechtotext_default');

// Create textarea for displaying transcription
const textareaObj: TextArea = new TextArea({
    rows: 5,
    cols: 50,
    value: '',
    resizeMode: 'None',
    placeholder: 'Transcribed text will be shown here...'
});
textareaObj.appendTo('#textareaInst');
<!DOCTYPE html>
<html lang="en">
<head>
    <title>SpeechToText Example</title>
    <link href="https://cdn.syncfusion.com/ej2/32.1.19/ej2-base/styles/fluent2.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/32.1.19/ej2-buttons/styles/fluent2.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/32.1.19/ej2-popups/styles/fluent2.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/32.1.19/ej2-inputs/styles/fluent2.css" rel="stylesheet" />
</head>
<body>
    <div id="container">
        <button id="speechtotext_default"></button>
        <textarea id="textareaInst"></textarea>
    </div>
</body>
</html>

Common Patterns

Pattern 1: Custom Button with Language Support

const speechToText: SpeechToText = new SpeechToText({
    lang: 'fr-FR', // French language recognition
    buttonSettings: {
        content: 'Commencer',
        stopContent: 'Arrรชter',
        isPrimary: true
    },
    transcriptChanged: (args: TranscriptChangedEventArgs) => {
        console.log('Transcript:', args.transcript);
    }
});
speechToText.appendTo('#speechtotext');

When to use: Internationalized applications requiring speech recognition in specific languages.

Pattern 2: Event-Driven State Management

const speechToText: SpeechToText = new SpeechToText({
    onStart: (args: StartListeningEventArgs) => {
        console.log('Started listening, state:', args.listeningState);
        // Update UI to show listening indicator
    },
    onStop: (args: StopListeningEventArgs) => {
        console.log('Stopped listening, state:', args.listeningState);
        // Update UI to hide listening indicator
    },
    onError: (args: ErrorEventArgs) => {
        console.error('Speech recognition error:', args.error);
        // Show error message to user
    },
    transcriptChanged: (args: TranscriptChangedEventArgs) => {
        // Real-time transcript updates
        document.getElementById('output').textContent = args.transcript;
    }
});
speechToText.appendTo('#speechtotext');

When to use: Applications requiring visual feedback and error handling during speech recognition.

Pattern 3: Programmatic Control with Custom Triggers

const speechToText: SpeechToText = new SpeechToText({
    transcriptChanged: (args: TranscriptChangedEventArgs) => {
        textArea.value = args.transcript;
    }
});
speechToText.appendTo('#speechtotext');

// Start listening when form field gains focus
document.getElementById('inputField').addEventListener('focus', () => {
    speechToText.startListening();
});

// Stop listening when form field loses focus
document.getElementById('inputField').addEventListener('blur', () => {
    speechToText.stopListening();
});

When to use: Integrating speech recognition with custom UI elements or form workflows.

Pattern 4: Final Results Only (No Interim)

const speechToText: SpeechToText = new SpeechToText({
    allowInterimResults: false, // Only final results
    transcriptChanged: (args: TranscriptChangedEventArgs) => {
        // Transcript only updates when recognition is complete
        textArea.value = args.transcript;
    }
});
speechToText.appendTo('#speechtotext');

When to use: Applications requiring complete sentences or phrases rather than real-time word-by-word transcription.

Key Properties

PropertyTypeDescriptionDefault
transcriptstringGets or sets the transcribed text''
langstringRecognition language (e.g., 'en-US', 'fr-FR')'en-US'
allowInterimResultsbooleanEnable real-time interim resultstrue
listeningStateSpeechToTextStateCurrent state (Inactive, Listening, Stopped)Inactive
showTooltipbooleanShow tooltip on button hovertrue
disabledbooleanDisable the componentfalse
enablePersistencebooleanPersist component state across page reloadsfalse
buttonSettingsButtonSettingsModelButton customization options{}
tooltipSettingsTooltipSettingsModelTooltip customization options{}
cssClassstringCustom CSS class for styling''
localestringLocalization culture (e.g., 'en-US', 'de')'en-US'
enableRtlbooleanEnable Right-to-Left layoutfalse

Common Use Cases

Use Case 1: Voice-Enabled Form Input

Enable users to fill form fields using voice input instead of typing, improving accessibility and speed for data entry tasks.

Use Case 2: Real-Time Transcription App

Build note-taking or meeting transcription applications that convert spoken words to text in real-time with language support.

Use Case 3: Voice Commands Interface

Implement voice command recognition for controlling application features, navigation, or triggering actions based on spoken keywords.

Use Case 4: Accessibility Enhancement

Provide voice input alternatives for users with mobility limitations who cannot easily type on keyboards.

Use Case 5: Multilingual Support

Support speech recognition in multiple languages for global applications, allowing users to speak in their preferred language.

Use Case 6: Voice Search Feature

Add voice search capabilities to applications, enabling users to search content by speaking queries instead of typing.

Best Practices

  1. Always handle errors gracefully - Implement onError event to catch and display user-friendly error messages for microphone access, network issues, or unsupported browsers.

  2. Request permissions explicitly - Inform users why microphone access is needed before triggering speech recognition to improve trust and permission grant rates.

  3. Use HTTPS in production - Speech recognition requires secure contexts; ensure your application is served over HTTPS to avoid security errors.

  4. Provide visual feedback - Use listening state events to show users when the component is actively listening, stopped, or inactive.

  5. Check browser compatibility - Verify browser support (Chrome 25+, Edge 79+, Safari 12+) and provide fallback UI for unsupported browsers.

  6. Configure appropriate language - Set the lang property to match your user's expected language for better recognition accuracy.

  7. Consider interim results - Use allowInterimResults:true for real-time feedback or false for final results only, depending on your use case.

  8. Implement privacy notices - Inform users that voice data may be processed by third-party services (Google, Microsoft) for speech recognition.

Related Components

  • TextArea - Often used together to display transcribed text
  • Button - Provides the base button functionality
  • Tooltip - Used for displaying helpful text on hover

Browser Support

BrowserSupported Versions
Chrome25+
Edge79+
FirefoxNot Supported
Safari12+
Opera30+

What ships with it: 7 files

123.3 KB alongside SKILL.md

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.