@sonoba/shared

v0.1.1

Published

Shared WebSocket protocol types for Voice Pipeline

Readme

@sonoba/shared

npm license

sonoba Voice Pipeline の WebSocket プロトコル型定義・ユーティリティ。

@sonoba/voice-client に同梱されているため、通常は直接インストール不要です。


インストール

npm install @sonoba/shared

提供するもの

プロトコル型定義

import type {
  ConnectionStatus,  // 'disconnected' | 'connecting' | 'connected' | 'ready' | ...
  SessionConfig,     // セッション開始時の設定
  ClientMessage,     // クライアント → サーバーのメッセージ型
  ServerMessage,     // サーバー → クライアントのメッセージ型
  VoiceEvent,        // イベント名の union 型
} from '@sonoba/shared';

ユーティリティ

import { SentenceChunker } from '@sonoba/shared';
// 文単位でテキストをチャンク分割(TTS 送信の最適化用)

import { float32ToPCM16, pcm16ToFloat32, concatArrayBuffers } from '@sonoba/shared';
// 音声データの変換ユーティリティ

ライセンス

MIT © sonoba