npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tpro-speech-sdk-js

v1.0.1

Published

A floating microphone widget for speech recognition

Downloads

10

Readme

T-Pro Speech SDK Js

A customizable, draggable floating microphone widget for real-time speech recognition with WebSocket support.

Features

  • 🎤 Floating microphone widget
  • 🔄 Real-time speech recognition
  • 🖱️ Draggable interface
  • 🎯 Customizable positioning
  • 🌐 WebSocket support
  • 📱 Responsive design
  • ⚡ Easy integration

Installation

npm tpro-speech-sdk-js

Quick Start

import { initSpeechWidget } from 'tpro-speech-sdk-js';

const config = {
    token: 'T-PRO-ACCESS-TOKEN',
    userId: 'T-PRO-USER-ID',
    engineId: 'T-PRO-ENGINE-ID',
    languageId: 'T-PRO-LANGUAGE-ID',
    topicId: 'T-PRO-TOPIC-ID'
};

const widget = initSpeechWidget(config);

Configuration Options

Required Configuration

const config = {
    // Required parameters
    token: 'T-PRO-ACCESS-TOKEN',      // Authentication token
    userId: 'T-PRO-USER-ID',          // User identifier
    engineId: 'T-PRO-ENGINE-ID',      // Speech recognition engine ID
    languageId: 'T-PRO-LANGUAGE-ID',  // Language code
    topicId: 'T-PRO-TOPIC-ID',        // Recognition topic/context
    
    // Optional parameters
    wsServer: 'wss://your-server',   // WebSocket server URL (optional)
    position: {                      // Widget position (optional)
        bottom: 20,
        right: 20
    },
    onResult: (result) => {          // Result callback (optional)
        console.log(result);
    }
};

Position Customization

const config = {
    position: {
        top: 20,      // Distance from top in pixels
        right: 20,    // Distance from right in pixels
        bottom: 20,   // Distance from bottom in pixels
        left: 20      // Distance from left in pixels
    }
};

Usage Examples

Basic Implementation

<!DOCTYPE html>
<html>
<head>
    <title>Speech Recognition Demo</title>
</head>
<body>
    <div id="transcription"></div>
    
    <script type="module">
        import { initSpeechWidget } from 'tpro-speech-sdk-js';

        const widget = initSpeechWidget({
            token: 'T-PRO-ACCESS-TOKEN',
            userId: 'T-PRO-USER-ID',
            engineId: 'T-PRO-ENGINE-ID',
            languageId: 'T-PRO-LANGUAGE-ID',
            topicId: 'T-PRO-TOPIC-ID',
            onResult: (result) => {
                document.getElementById('transcription').textContent = result.words[0];
            }
        });
    </script>
</body>
</html>

With Error Handling

try {
    const widget = initSpeechWidget({
        token: 'T-PRO-ACCESS-TOKEN',
        userId: 'T-PRO-USER-ID',
        engineId: 'T-PRO-ENGINE-ID',
        languageId: 'T-PRO-LANGUAGE-ID',
        topicId: 'T-PRO-TOPIC-ID'
        onResult: (result) => {
            handleRecognitionResult(result);
        }
    });

    // Listen for recognition events
    window.addEventListener('recognitionResult', (event) => {
        console.log('Recognition result:', event.detail);
    });
} catch (error) {
    console.error('Failed to initialize speech widget:', error);
}

Custom Styling

/* Override default widget styles */
.speech-recognition-widget {
    background-color: #007bff;
    width: 60px;
    height: 60px;
}

.speech-recognition-widget.stop {
    background-color: #dc3545;
}

Events

The widget emits events that you can listen to:

// Recognition result event
window.addEventListener('recognitionResult', (event) => {
    const result = event.detail;
    console.log('Transcription:', result.words[0]);
    console.log('Confidence:', result.confidence);
});

API Reference

initSpeechWidget(config)

Initializes and returns a new speech recognition widget instance.

Parameters:

  • config (Object): Configuration options
    • token (String): Authentication token
    • userId (String): User identifier
    • engineId (String): Speech recognition engine ID
    • languageId (String): Language code
    • topicId (String): Recognition topic
    • wsServer (String, optional): WebSocket server URL
    • position (Object, optional): Widget position
    • onResult (Function, optional): Result callback

Returns:

  • SpeechWidget instance

Widget Methods

const widget = initSpeechWidget(config);

// Stop recording and disconnect
widget.stop();

// Update widget position
widget.updatePosition({
    bottom: 40,
    right: 40
});

Browser Support

The widget supports all modern browsers that implement the MediaRecorder API:

  • Chrome (desktop & mobile)
  • Firefox (desktop & mobile)
  • Edge
  • Safari 14.1+
  • Opera

Development

To contribute to the development:

# Clone the repository
git clone https://github.com/T-Pro/tpro-speech-sdk-js.git

# Install dependencies
npm install

# Run development server
npm run dev

# Build for production
npm run build

# Run tests
npm test

Troubleshooting

Common Issues

  1. "io is not defined" error
// Make sure socket.io-client is installed
npm install socket.io-client

// And properly imported
import { io } from 'socket.io-client';
  1. Microphone access denied
// Ensure you have the proper permissions
await navigator.mediaDevices.getUserMedia({ audio: true });
  1. WebSocket connection failed
// Check your token and server URL
const config = {
    token: 'T-PRO-ACCESS-TOKEN',
    wsServer: 'wss://correct-server-url'
};

License

MIT License - see the LICENSE file for details.

Support

For support, please:

  1. Check the documentation
  2. Open an issue
  3. Contact support at [email protected]