Speech Synthesis __CAPGO_KEEP_0__ リポジトリ
このプラグインの完全なマークダウンガイドとインストール手順を含むセットアッププロンプトをコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-speech-synthesis`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/speech-synthesis/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
Section titled “Install”You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-speech-synthesis` plugin in my project.Manual Setup を好む場合は、次のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-speech-synthesisbunx cap syncインポート
「インポート」のセクションimport { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';API オーバービュー
「API オーバービュー」のセクションspeak
「speak」のセクション指定されたオプションで与えられたテキストを話します。 話し言葉は音声キューに追加されます。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const result = await SpeechSynthesis.speak({ text: 'Hello, world!', language: 'en-US', rate: 1.0, pitch: 1.0, volume: 1.0, queueStrategy: 'Add'});console.log('Utterance ID:', result.utteranceId);synthesizeToFile
Section titled “コンタインター”コンタインターにパックパックコンタインターをパックパック、アイルトショナに参、パックパックコンタインターを終了、アイルトショナに参だ。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const result = await SpeechSynthesis.synthesizeToFile({ text: 'Hello, world!', language: 'en-US'});console.log('Audio file saved at:', result.filePath);cancel
Section titled “フゥター”フゥターにパックパックを終了、アイルトショナに参、パックパックコンタインターを此当に参だ。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.cancel();パックパックコンタインターにパックパックを此当に参。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.pause();コンタインターにパックパックを此当に参、パックパックコンタインターを終了、アイルトショナに参だ。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.resume();isSpeaking
isSpeakingのセクション現在、話し言葉合成が話しているかどうかを確認します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isSpeaking } = await SpeechSynthesis.isSpeaking();console.log('Is speaking:', isSpeaking);isAvailable
isAvailableのセクションデバイス上で話し言葉合成が利用可能かどうかを確認します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isAvailable();if (isAvailable) { console.log('Speech synthesis is available');}getVoices
getVoicesのセクション利用可能なすべての声の取得
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { voices } = await SpeechSynthesis.getVoices();voices.forEach(voice => { console.log(`${voice.name} (${voice.language})`);});getLanguages
getLanguagesのセクション利用可能なすべての言語の取得
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { languages } = await SpeechSynthesis.getLanguages();console.log('Available languages:', languages);isLanguageAvailable
isLanguageAvailableのセクション特定の言語が利用可能かどうかを確認します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isLanguageAvailable({ language: 'es-ES'});console.log('Spanish available:', isAvailable);isVoiceAvailable
isVoiceAvailableのセクション特定の声が利用可能かどうかを確認します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isVoiceAvailable({ voiceId: 'com.apple.ttsbundle.Samantha-compact'});console.log('Voice available:', isAvailable);initialize
initializeのセクションiOSの最適化で話し言葉合成エンジンを初期化します。 最初の話し言葉要求で遅延を減らすことができます。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.initialize();activateAudioSession
activateAudioSessionのセクションiOSのみで特定のカテゴリでオーディオセッションを有効にします。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.activateAudioSession({ category: 'Playback'});deactivateAudioSession
セクション「deactivateAudioSession」iOSのみで、オーディオ セッションを無効にします。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.deactivateAudioSession();型参照
セクション「型参照」SpeakOptions
セクション「SpeakOptions」テキストを話すためのオプションです。
export interface SpeakOptions { /** * The text to speak. * * @since 1.0.0 */ text: string;
/** * The BCP-47 language tag (e.g., 'en-US', 'es-ES'). * * @since 1.0.0 */ language?: string;
/** * The voice identifier to use. * * @since 1.0.0 */ voiceId?: string;
/** * The pitch of the voice (0.5 to 2.0, default: 1.0). * * @since 1.0.0 */ pitch?: number;
/** * The speaking rate (0.1 to 10.0, default: 1.0). * * @since 1.0.0 */ rate?: number;
/** * The volume (0.0 to 1.0, default: 1.0). * * @since 1.0.0 */ volume?: number;
/** * The queue strategy: 'Add' to append or 'Flush' to replace queue. * Default: 'Add' * * @since 1.0.0 */ queueStrategy?: 'Add' | 'Flush';}SpeakResult
セクション「SpeakResult」テキストを話す結果です。
export interface SpeakResult { /** * Unique identifier for this utterance. * * @since 1.0.0 */ utteranceId: string;}SynthesizeToFileResult
セクション「SynthesizeToFileResult」ファイルに合成した結果です。
export interface SynthesizeToFileResult { /** * The file path where audio was saved. * * @since 1.0.0 */ filePath: string;
/** * Unique identifier for this utterance. * * @since 1.0.0 */ utteranceId: string;}VoiceInfo
「声情報」セクション声に関する情報
export interface VoiceInfo { /** * Unique voice identifier. * * @since 1.0.0 */ id: string;
/** * Display name of the voice. * * @since 1.0.0 */ name: string;
/** * BCP-47 language code. * * @since 1.0.0 */ language: string;
/** * Gender of the voice (iOS only). * * @since 1.0.0 */ gender?: 'male' | 'female' | 'neutral';
/** * Whether this voice requires a network connection. * * @since 1.0.0 */ isNetworkConnectionRequired?: boolean;
/** * Whether this is the default voice (Web only). * * @since 1.0.0 */ default?: boolean;}IsLanguageAvailableOptions
「言語利用可能オプション」セクション言語利用可能性を確認するためのオプション
export interface IsLanguageAvailableOptions { /** * The BCP-47 language code to check. * * @since 1.0.0 */ language: string;}IsVoiceAvailableOptions
「声利用可能オプション」セクション声利用可能性を確認するためのオプション
export interface IsVoiceAvailableOptions { /** * The voice ID to check. * * @since 1.0.0 */ voiceId: string;}ActivateAudioSessionOptions
「オーディオセッションを有効化するオプション」セクションiOSで使用可能なオーディオセッションのオプション。
export interface ActivateAudioSessionOptions { /** * The audio session category. * - 'Ambient': Mixes with other audio * - 'Playback': Stops other audio * * @since 1.0.0 */ category: 'Ambient' | 'Playback';}UtteranceEvent
UtteranceEvent発話イベントが始まるか終わるたびに発生するイベント。
export interface UtteranceEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;}BoundaryEvent
BoundaryEvent単語境界で発生するイベント。
export interface BoundaryEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;
/** * The character index in the text. * * @since 1.0.0 */ charIndex: number;
/** * The character length of the current word. * * @since 1.0.0 */ charLength?: number;}ErrorEvent
エラーイベントが発生するたびに発生するイベント。__CAPGO_KEEP_0__
export interface ErrorEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;
/** * The error message. * * @since 1.0.0 */ error: string;}真実の源
「ソース オブ トゥルース」プラグインの生成元のページです。 src/definitions.ts. upstream の public API が変更された場合に再度 sync を実行してください。
「Getting Started」から続けてください。
「Getting Started」から続けてください。「Capacitor」を使用している場合 「Getting Started」を使用してダッシュボードと __CAPGO_KEEP_0__ の操作を計画する場合、 @API/__CAPGO_KEEP_1__-speech-synthesis 「@capgo/capacitor-speech-synthesis」を使用して、 @capgo/capacitor-speech-synthesis 「API」の概要 「API」の実装詳細 Introduction Introductionの実装詳細について API Keys API Keysの実装詳細について Devices Devicesの実装詳細について