🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@pie-players/pie-tts

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pie-players/pie-tts

TTS interfaces and types for PIE Assessment Toolkit - No UI dependencies

latest
Source
npmnpm
Version
0.3.50
Version published
Maintainers
2
Created
Source

@pie-players/pie-tts

TTS interfaces and types for PIE Assessment Toolkit - Pure TypeScript with no UI dependencies.

For the cross-package TTS architecture, provider layering, and server/client runtime flow, see TTS Architecture.

Purpose

This package provides the foundational interfaces and types for building TTS (Text-to-Speech) providers in the PIE ecosystem. It has zero dependencies and no UI framework requirements, making it suitable for:

  • Implementing custom TTS providers
  • Type-safe TTS integration
  • Framework-agnostic TTS solutions

What's Included

Interfaces

  • ITTSProvider - Stateless factory for creating TTS implementations
  • ITTSProviderImplementation - Actual TTS playback implementation
  • TTSProviderCapabilities - Feature support description
  • TTSConfig - Provider configuration

Types

  • TTSFeature - Union type of supported features
  • Configuration and capability types

Installation

npm install @pie-players/pie-tts
# or
bun add @pie-players/pie-tts

Usage

Implementing a Custom TTS Provider

import type {
  ITTSProvider,
  ITTSProviderImplementation,
  TTSConfig,
  TTSProviderCapabilities,
  TTSFeature
} from '@pie-players/pie-tts';

class MyTTSImplementation implements ITTSProviderImplementation {
  async speak(text: string): Promise<void> {
    // Your implementation
  }

  pause(): void { /* ... */ }
  resume(): void { /* ... */ }
  stop(): void { /* ... */ }
  isPlaying(): boolean { return false; }
  isPaused(): boolean { return false; }
}

export class MyTTSProvider implements ITTSProvider {
  readonly providerId = 'my-tts';
  readonly providerName = 'My TTS Provider';
  readonly version = '1.0.0';

  async initialize(config: TTSConfig): Promise<ITTSProviderImplementation> {
    return new MyTTSImplementation(config);
  }

  supportsFeature(feature: TTSFeature): boolean {
    return feature === 'pause' || feature === 'resume';
  }

  getCapabilities(): TTSProviderCapabilities {
    return {
      supportsPause: true,
      supportsResume: true,
      supportsWordBoundary: false,
      supportsVoiceSelection: true,
      supportsRateControl: true,
      supportsPitchControl: false,
    };
  }

  destroy(): void {
    // Cleanup if needed
  }
}

Official Implementations

  • Browser TTS (in @pie-players/pie-assessment-toolkit) - Uses Web Speech API, always available as fallback
  • Server TTS (@pie-players/tts-client-server) - High-quality server-backed voices (Polly/Google/etc.) with speech marks

Design Philosophy

This core package intentionally:

  • ✅ Has zero runtime dependencies
  • ✅ Contains only TypeScript interfaces and types
  • ✅ Is framework-agnostic (no React, Svelte, Vue, etc.)
  • ✅ Supports pluggable architecture
  • ✅ Enables type-safe TTS implementations

License

MIT

Keywords

pie

FAQs

Package last updated on 09 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts